1

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);
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
giang.asl.8
  • 313
  • 2
  • 11

1 Answers1

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 
    

CompatibilityViewSettings_IE

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • 1
    Your suggestion of setting IE compatibility settings saved me!!! After adding my website URL to compatibility list, it correctly turn on compatibility mode when selenium start up the page, and javascript return "Microsoft Internet Explorer" for navigator.appName as expected. But will someone help me to figure out, why IE, started by Selenium refuses to turn on compatibility mode automatically, like when launched manually? – giang.asl.8 Dec 11 '17 at 01:30