Some useful tips while launching tips in
launching browser:
Hurdle: Get following
error on launching the IE browser:
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).
In case such error is displayed in the console,
it is asking to set same protected mode setting for all the zones. This can be
set as shown in screenshot below:
Hurdle: Some Websites especially in QA environment do not have proper certificates installed due to which we get an error Page with issue with security certificate. Once user clicks on Continue to this Website (not recommended), a pop up appears. How to handle the pop up window?
Usually in QA environment, on navigating a page
is https://, certificate error is displayed. The links in the Page are
identified easily using selenium, but the pop up is not handled properly using
alerts as:
Alert
alert = driver.switchTo().alert();
alert.accept();
Alerts
are used to handle javascript alerts that pop up in between.
Alerts
can be used to accept a pop up, dismiss a pop up,getText(),SendKeys.
I
tried to handle the pop up for res://ieframe.dll/ using alerts, but it did not
work out. On further trying, I find a simple solution to the solution. The
solution to the problem is to add res://ieframe.dll/ to the trusted sites or local
intranet.
Hurdle: Exception
in thread "main" org.openqa.selenium.remote.SessionNotFoundException:
Unexpected error launching Internet Explorer. Browser zoom level was set to
150%. It should be set to 100% (WARNING: The server did not provide any
stacktrace information
This error occurs in case the zoom level is set different from 100%
zoom level.
So to consolidate, before running any test in IE, we should ensure :
a.
Protected
mode is set same for all the internet zones and
b.
Zoom level
is set as 100% in the IE browser.
How do we maximize
the browser on launching the browser?
Using below code , we can maximise the browser:
WebDriver driver;
File file = new File("D:\\Selenium\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver",
file.getAbsolutePath());
driver = new
InternetExplorerDriver();
driver.manage().window().maximize();
No comments:
Post a Comment