geckodriver Windows身份验证 [英] geckodriver windows authentication

查看:70
本文介绍了geckodriver Windows身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am upgrading my tests to use Selenium 3.4.0. Running the test with the latest chrome driver I have no problems, when I configure the tests to use geckodriver I receive a windows Authentication Required dialog:

屏幕截图

这是我对FirefoxDriver的配置:

Here is my configuration for the FirefoxDriver:

System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver.exe");
driver = new FirefoxDriver();

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

The console output shows the following:

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错误:

I am not sure why I am getting this javascript error:

JavaScript error: resource://gre/modules/AddonManager.jsm, line 2572: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized

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

Any reason why the geckodriver is causing the windows authentication dialog to appear?

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

The website is an internal application that use kerberos for authentication.

推荐答案

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

I was able to solve this by upgrading to Selenium 3.6.0, and then passing the following preferences to the driver:

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);

这篇关于geckodriver Windows身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆