0
votes

I am using selenium grid for running my scripts on different browsers on the same machine (hub and nodes are on same machine) . My code is running perfectly fine on firefox but is giving an error on Internet Explorer.

I have used the following command for configuring internet explorer :

java -jar selenium-server-standalone-2.25.0.jar -role webdriver -hub http://:4444/grid/register -port 5554 -browser platform=WINDOWS,ensureCleanSession=true,browserName="iexplore",version=8,ignoreProtectedModeSettings=true, javascriptEnable=true

I am using testng for running the scripts.

On running the test, Internet Explorer window opens but it displays "This is the initial start page of Webdriver" .The URL specified in test does not open and i get the following error :

org.openqa.selenium.UnhandledAlertException: Modal dialog present

Here is my code for setting the Desired Capabilities of IE :

if(browser.equalsIgnoreCase("iexplore")){
            System.out.println("iexplore");
            capability= DesiredCapabilities.internetExplorer();
            capability.setBrowserName("iexplore");
            capability.setVersion("8");
            capability.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
            capability.setPlatform(org.openqa.selenium.Platform.WINDOWS);
        }

This is the code for opening the browser:

URL url = new URL("http://<hostname>:4444/wd/hub");
driver = new RemoteWebDriver(url, capability);
driver.get("http://google.com");

Please help in solving my issue. Thanks a lot

1
A modal dialog present would mean that there is something popping up on launching the site, can be a security warning or mixed content warning. Can you see any dialog box popping up on execution? - niharika_neo
There isn't any pop up coming up. Even my pop up blocker is disabled. Internet Explorer opens and displays "This is the initial start page of Webdriver". On checking the error logit displays the error at line driver = new RemoteWebDriver(url, capability); even tried creating a direct instance of browser using driver = new InterneExplorerDriver() but still facing the same issue. - megha
I have a very similar issue. Haven't found a workaround yet, but in my case a modal window is triggerred by switching from http to https. This modal closes pretty fast though. I suggest checking for modal window appearances during login or similar actions. - Ubermensch_01

1 Answers

0
votes

I had a very similar issue. In my case it was an alert appearing while switching from http to https. Use the following statements to handle the alert:

WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = driver.switchTo().alert();
alert.accept();

This did the trick for me. Hope this solution will help.