In this tutorial we will discuss about Fixing the issues that arises during execution of Selenium WebDriver tests against the browser Type Internet Explorer. Before Running Tests, make sure the following settings are updated for the Internet Explorer.
Browser Zoom Level
Access File Menu->View->zoom
should be set to 100%.
Protected Mode Settings
Access File Menu->Tools-> Internet Options->Security
.
Make sure the Protected Mode is enabled or disabled for all the Security Zones as listed below:
- Internet Zone
- Local intranet
- Trusted Sites
- Restricted Sites
Executable File
Add the IEDriverServer.exe
to the eclipse project by downloading from the link https://www.seleniumhq.org/download/
Untrusted SSL Certificate
To Handle the SSL Certificates on IE Browsers use the following code snippet to Handle SSL Certificates. This logic clicks on the link Continue to this website(recommended)
driver.navigate().to(“javascript:document.getElementById(‘overridelink’).click()”);
Selenium WebDriver Program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import org.openqa.selenium.ie.InternetExplorerDriver; public class IEDriverTests { public static void main(String[] args) { System.setProperty("webdriver.ie.driver", "IEDriverServer.exe"); //open the browser without any url InternetExplorerDriver driver = new InternetExplorerDriver(); //enter the url driver.get("http://www.indeed.co.in"); //retrieve the title String title = driver.getTitle(); //Prints the title in the console System.out.println("Title of the page " + title); //close the browser driver.close(); } } |
Conclusion
Therefore, setting the zoom to 100% and enabling or disabling the protected mode for all the security zones resolves the SessionNotCreatedError
.