Firefox中不受信任的SSL证书使用WebDriver和C# [英] Untrusted SSL Certificates in Firefox Using WebDriver and C#
问题描述
最新编辑:定义pref后仍然不工作(见下文) p>
//一些更多的前缀:
profile.SetPreference(network.http.phishy-userpass-length,255) ;
profile.SetPreference(network.automatic-ntlm-auth.trusted-uris,_url);
profile.SetPreference(webdriver_assume_untrusted_issuer,true);
profile.SetPreference(webdriver_accept_untrusted_certs,true);
profile.SetPreference(trustAllSSLCertificates,true);
我使用FF 25.0.1
Webdriver版本:2.31
我以前从来没有遇到过这个问题,但刚开始运行我的自动化测试用例时,发生的情况是,我得到了SSL认证错误,即使我已经接受并添加为例外但我仍然得到错误,因此我的测试案例是失败的...
这是我在建立fd webdriver时添加的内容...
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference(network.http.phishy-userpass-length,255);
profile.SetPreference(network.automatic-ntlm-auth.trusted-uris,_url);
profile.SetPreference(webdriver_assume_untrusted_issuer,false);
drv = new FirefoxDriver(profile);
屏幕快照 我已经尝试了@Akabar在注释中写道的方式,我可以共享更多关于如何解决此问题的详细信息:
您可以在这里查看以供参考:
步骤如下:步骤1 - 手动打开FF并手动接受自签名证书(我的意思是接受sec_error_unknown_issuer安全例外) / p>
第2步 - 找到您的FF配置文件目录并复制配置文件目录的路径ex(MAC env):/ Users / UserABC / Library / Application Support / Firefox /Profiles/vndms5adearwtry.d在你的selenium代码(java版本)中,使用下面的方法来初始化FirefoxDriver:
$ b 第三步 - 在你的selenium代码
FirefoxProfile firefoxProfile = new FirefoxProfile(new File(/ Users / UserABC / Library / Application Support / Firefox / Profiles / vndms5adearwtry.default));
DesiredCapabilities功能= DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE,firefoxProfile);
FirefoxDriver驱动程序=新的FirefoxDriver(功能);
希望有帮助。
UPDATE: i upgrade to Selenium 2.37 but still having the same problem!!
LATEST EDIT: still does not work after defining the pref (see below)
//some more prefs:
profile.SetPreference("network.http.phishy-userpass-length", 255);
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", _url);
profile.SetPreference("webdriver_assume_untrusted_issuer", true);
profile.SetPreference("webdriver_accept_untrusted_certs", true);
profile.SetPreference("trustAllSSLCertificates", true);
I'm using FF 25.0.1 Webdriver version: 2.31
I never had this problem before but just started when i start running my automated test cases so what is happening is that i am getting SSL certification error and even though i have accepted and add as an exception but i still getting the error and hence my test case is failing...
here is what i have added when i'm building ff webdriver...
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("network.http.phishy-userpass-length", 255);
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", _url);
profile.SetPreference("webdriver_assume_untrusted_issuer", false);
drv = new FirefoxDriver(profile);
I've tried the way @Akabar wrote above in the comment and I can share more detail s about how I fix this issue: You can check here for your reference: Selenium Webdriver: Surpressing untrusted connection message in firefox
The steps are:
Step 1 - Open your FF manually and accept the self-signed certificate manually (I mean accept "sec_error_unknown_issuer" security exception)
Step 2 - Locate your FF's profile directory and copy the path of the your profile directory, ex(MAC env): "/Users/UserABC/Library/Application Support/Firefox/Profiles/vndms5adearwtry.default"
Step 3 - In your selenium code(java version), use the following way to init the FirefoxDriver:
FirefoxProfile firefoxProfile = new FirefoxProfile(new File("/Users/UserABC/Library/Application Support/Firefox/Profiles/vndms5adearwtry.default"));
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
FirefoxDriver driver = new FirefoxDriver(capabilities);
Hope it helps.
这篇关于Firefox中不受信任的SSL证书使用WebDriver和C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!