When we try to launch IE using WebDriver on a very first time on a fresh computer, generally we get the below error:
Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
We can avoid this using DesiredCapabilities method. The code can be:
DesiredCapabilities DC = DesiredCapabilities.internetExplorer();
DC.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
You can find more on this method here: DesiredCapabilities
So to run your test in IE browser here the complete code:
package WedriverPackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class crossBrowserTesting
{
public static void main(String[] args)
{
DesiredCapabilities DC = DesiredCapabilities.internetExplorer(); DC.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
System.setProperty("webdriver.ie.driver","C:\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver(DC);
driver.get("https://www.vishalsachan.blogspot.com/");
}
}
Software Testing, Test Automation, Test Consulting, and Trainings...... Learn from experience
Showing posts with label IE. Show all posts
Showing posts with label IE. Show all posts
Thursday, April 28, 2016
Subscribe to:
Posts
(
Atom
)