I am trying to automate a webpage using selenium in IE11. I have set the protected mode settings to same level and zoom level is 100%. While running the test it opens the we
Added domain of AUT to list of "Trusted Sites" for i.e. in "Internet Options". Solved the problem.
You can follow a few options from below:
This states that whatever being done by your code (the web driver) is not able to identify the window of IE.
The possible causes can be: a. Multiple driver instances are already running which were instantiated by older runs and could not have been terminated by quite(). b. The sometimes when you use close() on a driver it will not terminate the IE Driver, so use quite() after closing inside a finally block. Yes, add some Exception handling to avoid the above issue.
Exception "org.openqa.selenium.NoSuchWindowException" also suggests that web driver instance is not able to get the handle of IE's window tab. I faced this issue when accidentally, the browser was closed and the code was still trying to locate and do some action on a web element. In this case, the driver throws this exception to tell that there is no IE browser opened at all.
Having a check on the opening of browser can also help, I usually keep some piece of code that gives logs of used Driver object and the port where it is trying to connect and to which browser to.
For me, point 4 & 5 worked. but you might wanna just change the web driver's service i.e. browser. IE is just too slow sometimes to honour the selenium API calls :(
First of all, don't use
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
as you have already set Protected mode settings. For the issue you are seeing, it should be because of the missing registry settings that is added as a prerequisite for running tests in IE11:
https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration
Add http://localhost/ to your trusted sites in IE11. This worked for me,after trying everything else without results.