Enabling protected mode settings in Internet Explorer

Sometimes, while using Internet Explorer for the first time, a Session not found exception is thrown. To resolve this exception, do either of the following:

  • Manually click the Enable Protected Mode Setting checkbox under the Security tab of Internet Options. Click the checkbox for Internet, Local Intranet, Trusted Sites, and Restricted Sites. This checkbox should be checked for all four tabs; the settings should be the same.
  • Write the following code. The code ignores Internet Explorer's protected mode settings:
      InternetExplorerOptions options = new InternetExplorerOptions();
      options.IntroduceInstabilityByIgnoringProtectedModeSettings = 
true;
WebDriver driver = new InternetExplorerDriver(options);
driver.get("http://www.google.com");

Here, Internet Explorer options are passed as an argument to the InternetExplorerDriver constructor. This code does the same work as is done by enabling the protected mode setting manually. We will look at Internet Explorer options in the next section. 

DesireCapabilities is now going to be deprecated and hence Selenium has introduced Chrome, Firefox, and Internet Explorer options, which we will look at next.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.124.8