问题
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 withInternet 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