簡體   English   中英

硒webdriver異常(在Firefox中)

[英]selenium webdriver exception (in firefox)

即時通訊使用硒firefox驅動程序3.3.1,硒java 3.3.0,壁虎驅動程序0.14和firefox52。當我運行我的代碼“您的連接不安全”頁面時,但當我手動打開它時,它將打開而沒有任何錯誤是我收到的錯誤消息

線程“主”中的異常org.openqa.selenium.WebDriverException:在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本機方法)處,在sun.reflect.NativeConstructorAccessorImpl.newInstance(未知源)處,在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(未知源)處org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)處的org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode處的java.lang.reflect.Constructor.newInstance(未知源) org.openqa.selenium.remote上的W3CHttpResponseCodec.java:93).http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecorg.java:163) org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)上的.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82),位於org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.get .java:325),請參見Automation.Qwi k_events_uat_firefox.main(Qwik_events_uat_firefox.java:24)

根據壁虎司機

acceptInsecureCerts
布爾值最初設置為false,表示會話在導航時將不會隱式信任不可信或自簽名的TLS證書。

您可以像下面那樣初始化FirefoxDriver以避免問題

    FirefoxProfile ff = new FirefoxProfile();
    ff.setAcceptUntrustedCertificates(true);
    WebDriver driver = new FirefoxDriver(ff);

或者您可以使用DesiredCapabilities之類的

    DesiredCapabilities caps = DesiredCapabilities.firefox();
    caps.setCapability("acceptInsecureCerts", true);
    WebDriver driver = new FirefoxDriver(caps);

另外,您應該使用GeckoDriver 0.15,因為硒建議這樣做

根據硒變更日志

v3.3.1

  • 更好地支持geckodriver v0.15.0。 值得注意的是,現在已正確地解包了從遠程端返回的異常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM