2017-05-24 73 views
0

我有Firefox v53.0.2 Selenium Webdriver 3.4.0 安裝了Geckodriver 0.16.1。Selenium Webdriver的AddonsManager啓動錯誤3.4.0

在運行測試腳本時,我收到以下錯誤:

1495619876437 geckodriver INFO Listening on 127.0.0.1:27938 
1495619876783 geckodriver::marionette INFO Starting browser \\? 
\C:\Program Files\Mozilla Firefox\firefox.exe with args ["-marionette"] 
1495619878148 addons.manager ERROR startup failed: [Exception... 
"Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) 
[nsIFile.create]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" 
location: "JS frame :: resource://gre/modules/FileUtils.jsm :: 
FileUtils_getDir :: lineJavaSc r7i0p"t edrartoar:: nroe]s oSutraccek: 
/t/rgarcee/:m oFdiulleeUst/iAldsd_ogneMtaDniarg(e)[email protected],u 
rlce://gre/modules/FileUtils.jsm:7i0n e< 1F6i5l7e:U 
tNiSl_sE_RgReOtRF_iNlOeT(_)[email protected]:D/:/ gArdedonMan/amgoedru 
liess /nFoitl eiUntiitlisa.ljiszme:d4 
2 
< validateBlocklist()@resource://gre/modules/AddonManager.jsm:671 < 
startup()@resource://gre/modules/AddonManager.jsm:834 < 
startup()@resource://gre/modules/AddonManager.jsm:3129 < 
observe()@resource://gre/components/addonManager.js:65 
1495619881253 Marionette INFO Listening on port 55174 
JavaScript error: resource://gre/modules/AddonManager.jsm, line 2570: 
NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized 
1495619882013 Marionette WARN TLS certificate errors will be ignored 
for this session 
May 24, 2017 3:28:02 PM org.openqa.selenium.remote.ProtocolHandshake 
createSession 
INFO: Detected dialect: W3C 
JavaScript error: 
https://www.gstatic.com/recaptcha/api2/r20170515161201/recaptcha__en.js, 
line 372: Error: Missing required parameters: sitekey 

我的代碼片段看起來像:

@BeforeClass(alwaysRun = true) 
    public void setUp() throws Exception { 
    System.setProperty("webdriver.gecko.driver","D:\\geckodriver.exe"); 
    DesiredCapabilities capabilities = DesiredCapabilities.firefox(); 
    capabilities.setCapability("marionette", true); 
    System.setProperty("webdriver.gecko.driver","D:\\geckodriver.exe"); 
    driver=new FirefoxDriver(capabilities); 
baseUrl = "https://www.google.com/"; 
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); 
} 

問題是什麼,需要修改什麼呢?請幫助..

回答

0

這裏是回答你的問題:

我看不出有任何顯著誤差,例如在你的代碼。

通過將marionette設置爲「true」,您邁出了一大步。但是您看到addons.manager ERROR的原因是因爲您未抑制/忽略JavaScript錯誤。雖然這些都是無害的,你可以和他們一起生活。

最後,您不應該在代碼中提及System.setProperty兩次,因爲它可能會在您的測試執行中導致不必要的混亂。 System.setProperty("webdriver.gecko.driver","D:\\geckodriver.exe");

讓我知道這個答案是否是您的問題。

相關問題