I have some Selenium 2 Webdriver test cases for Firefox and Internet Explorer 9. When I access https URLs on IE9 (Windows 7 64bit) I get "There is a problem with this website's security certificate". At this point the t开发者_StackOverflow社区est hangs and eventually fails. I tried:
Finally, I don't have admin access to my PC - e.g. no access to group policies. Selenium 2 Webdriver works fine on Firefox. I have all security zones enabled in IE Internet Options and if I run the tests on other URLs (http) then there is no problem.
Has anyone got a solution to this problem? Does anyone now hot to use browsermob proxy (or any other proxy) effectively to overcome this issue?
Thanks, Damo
Okay I just got it working under IE9 using C# and the following code:
IWebDriver driver = new InternetExplorerDriver();
driver.Url(YOUR_URL);
driver.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()");
And now it will go to the intended page. For Java it's as simple as:
WebDriver driver = new InternetExplorerDriver();
driver.get(YOUR_URL);
driver.get("javascript:document.getElementById('overridelink').click();");
Using the Selenium-Python bindings:
#region SSL workaround for IE
if "Certificate Error" in driver.title:
driver.get("javascript:document.getElementById('overridelink').click();")
I found the answer on the SQA board: https://sqa.stackexchange.com/questions/1928/selenium-2-webdriver-and-ie-9-security-certificate
We created a certificate and it It worked like a charm.
This worked for me in the past, give it a try,
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
Webdriver driver = new InternetExplorerDriver(capabilities);
Any progess in this? I'm trying to do this capabilities thing... but I don't know how to do it using Ruby :(
In chrome it is simple since you can use switches:
nav=Selenium::WebDriver.for(:chrome, :switches => %w[--ignore-certificate-errors -])
Maybe it is possible to do it for IE using switches
there is a much simpler solution in case you use IE driver, documented in this reply. The added benefit is that you don't have to be the site owner and you don't have to tangle with browsermob or the registry or any other low-level technology
We can use the the following code.
wait =new WebDriverWait(webdriver, 10);
webdriver.get(url);
WebElement ele =wait.until(ExpectedConditions.elementToBeClickable(
webdriver.findElement(By.linkText("Continue to this website (not
recommended)."))));
ele.click();
The other answers have the correct idea, but fail in practice because the WebDriver
doesn't navigate immediately to the certificate error page. The correct implementation should wait a bit.
new WebDriverWait(driver, 10).until(ExpectedConditions.titleContains("Certificate"));
driver.navigate().to("javascript:document.getElementById('overridelink').click()");
精彩评论