首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >geckodriver windows身份验证

geckodriver windows身份验证
EN

Stack Overflow用户
提问于 2017-06-28 05:11:30
回答 1查看 728关注 0票数 0

我正在升级我的测试以使用Selenium 3.4.0。使用最新的chrome驱动程序运行测试没有问题,当我将测试配置为使用geckodriver时,我收到一个需要windows身份验证的对话框:

screenshot

以下是我对FirefoxDriver的配置:

代码语言:javascript
复制
System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver.exe");
driver = new FirefoxDriver();

控制台输出显示以下内容:

代码语言:javascript
复制
1498596765531   geckodriver INFO    Listening on 127.0.0.1:40330
1498596766187   geckodriver::marionette INFO    Starting browser \\?
\C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-
marionette"]
:
 no] Stack trace: FileUtils_getDir()@resource://gre/modules/FileUtils.jsm:70 
< FileUtils_getFile()@resource://gre/modules/FileUtils.jsm:42 < 
validateBlocklist()@resource://gre/modules/AddonManager.jsm:674 < 
startup()@resource://gre/modules/AddonManager.jsm:837 < 
startup()@resource://gre/modules/AddonManager.jsm:3145 < 
observe()@resource://gre/components/addonManager.js:65
1498596767838   Marionette  INFO    Listening on port 50529
JavaScript error: resource://gre/modules/AddonManager.jsm, line 2572: 
NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
Jun 27, 2017 1:52:48 PM org.openqa.selenium.remote.ProtocolHandshake 
createSession
INFO: Detected dialect: W3C

我不确定为什么我会得到这个javascript错误:

代码语言:javascript
复制
JavaScript error: resource://gre/modules/AddonManager.jsm, line 2572: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized

为什么geckodriver会导致出现windows身份验证对话框?

该网站是使用kerberos进行身份验证的内部应用程序。

EN

回答 1

Stack Overflow用户

发布于 2017-10-13 02:52:20

我能够通过升级到Selenium 3.6.0来解决这个问题,然后将以下首选项传递给驱动程序:

代码语言:javascript
复制
FirefoxProfile ffprofile = new FirefoxProfile();
String sitelist = "mydomain.com, https://myotherdomain.com";
ffprofile.setPreference("browser.tabs.remote.force-enable",true);
ffprofile.setPreference("network.negotiate-auth.trusted-uris", sitelist);
ffprofile.setPreference("network.negotiate-auth.delegation-uris", sitelist);
ffprofile.setPreference("network.automatic-ntlm-auth.trusted-uris", sitelist);
FirefoxOptions options = new FirefoxOptions();
options.setProfile(ffprofile);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44789965

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档