In IE: org.openqa.selenium.WebDriverException: Thi

2020-02-07 01:58发布

I am using Selenium to write test cases for my web application. When I run the test from Firefox it's working fine, but when I try to run it from IE I am not able to run and I get the error message:

This usually means that a call to the COM method IWebBrowser2::Navigate2() failed exception.

System.setProperty("webdriver.ie.driver", "browserdrivers/IEDriverServer.exe");
WebDriver web =  new InternetExplorerDriver();
web.get("URL");

I am able to see IE screen but it's not navigating to that URL, and I am getting above exception. How can I resolve this ?

3条回答
放我归山
2楼-- · 2020-02-07 02:01

I've just encountered that problem myself. For me, the problem was that my application uses HTTP Basic Authentication, and that I was attempting to set the username/password combination via the page URL, like this: http://username:password@host/path

Problem is by default IE doesn't allow you to set the username and password this way (it's a security feature), and that causes the error above.

To fix this, I had to add a registry value in regedit. In the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE add a new DWORD value with the name iexplore.exe and the value 0, as described in this other answer https://stackoverflow.com/a/23519791/80779

查看更多
疯言疯语
3楼-- · 2020-02-07 02:06

I resolved this issue by manually running internet explorer. When the browser loaded, I was prompted with a dialog to 'Set up Internet Explorer 11'. I selected 'Use recommended security, privacy, and compatibility settings' and clicked 'OK'.

After the dialog closed, my browser displayed a configuration page called 'Caution: Internet Explorer Enhanced Security Configuration is not enabled' - I ignored this and closed the browser and tried running the automation test again with success.

查看更多
一纸荒年 Trace。
4楼-- · 2020-02-07 02:14

You must set the Protected Mode settings for each zone to be the same value in the Internet Explorer. Hope the below link may be helpful to you.

NoSuchElementException is occurred during implementation of InternetExplorerDriver in Selenium WebDriver

Regards,

Vignesh

查看更多
登录 后发表回答