IE11 fails with “Netscape is not supported please used internet explorer” error when launch by Selenium

走远了吗. 提交于 2019-12-11 08:07:36

问题


I have a quite old website to be maintained, supports IE8 and above. Now I've a plan to do some test automation on the site, using Selenium WebDriver (version 3.7.1). Almost everything works well, except for some pages that use document.getElementById(). The point is, these pages utilize the "feature" of IE11 that when no element matches with specified ID, it then returns the element with that ID as name (as denoted in this thread).
And when brower (IE11) started by selenium, it fails to invoke that code (return a NULL, causing error).
Further investigate, I found that, when launched manually, invoking navigator.appName returns "Microsoft Internet Explorer", while returns "Netscape" in the other case.
What does that difference mean, and is that the root cause of my problem. And most important, how to resolve that?

I'm launching the page with this source code:

DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
WebDriver driver = new InternetExplorerDriver(
                    new InternetExplorerOptions(ieCapabilities));
wait = new WebDriverWait(driver, 30);
driver.get(url);

回答1:


As you mentioned invoking navigator.appName returns "Microsoft Internet Explorer" while returns "Netscape" in the other case is a rare but prevailing scenario. The complete error reads as :

"Netscape is not supported please used internet explorer "

Solution:

To address this, you have to consider the following points:

  • Internet Explorer Driver runs in a real browser and supports Javascript.
  • Try to avoid any Add On's with Internet Explorer
  • If you have to use any mandatory Add On's, (for all IE9,IE10,IE11 and Windows 8 users)

    1. Open the desired website in Internet Explorer
    2. Go to "Compatibility View settings" (image shown below)
    3. In a dialog box add your website in the list.
    e.g. if you are trying to use "ssconline.nic.in" , then add "nic.in" in the list 
    



来源:https://stackoverflow.com/questions/47631849/ie11-fails-with-netscape-is-not-supported-please-used-internet-explorer-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!