2017-02-12 23 views
1
@Test 
public void captchImage() throws IOException 
{ 
    File file = new File("extension.xpi"); 
    FirefoxProfile firefoxProfile = new FirefoxProfile(); 
    firefoxProfile.addExtension(file); 
    WebDriver driver = new FirefoxDriver(firefoxProfile); 
    driver.get("http://njdg.ecourts.gov.in/njdg_public/index.php"); 

我想與插件一起打開Firefox瀏覽器i attached image please go through that如何使用taht我加入瀏覽器的所有插件一起打開瀏覽器

+0

什麼是'extension.xpi'? –

+0

代碼似乎是正確的,提供的路徑xpi文件是正確的(是嗎?)。你正在使用哪種Firefox,並且是你的擴展簽名?最新的FF不喜歡未簽名的擴展。我建議在瀏覽器打開時暫停測試並檢查擴展是否存在,以及是否已啓用(可能已安裝但未啓用) –

+0

@KirilS。我的擴展已簽署 –

回答

0

你並不需要啓動你的插件就是這樣,寧願用ProfileIni推出所需的配置文件。 Profile management in Selenium

將您的擴展程序存儲在配置文件中,然後獲取該配置文件名稱並在瀏覽器中啓動它。 啓動特定的配置文件。

ProfileIni pro=new ProfileIni(); 
org.openqa.selenium.firefox.FirefoxProfile profile=pro.getProfile("ProfileName"); 
WebDriver driver=new FirefoxDriver(profile) 
+0

我試過了,但它不起作用 –

+0

你能分享你試過的代碼嗎? –

+0

您好先生,我不能解釋更多,我是一個初學者,所以難以理解 –