Webdriver: Tests crash with internet explorer7 with error Modal dialog present

Posted by user1207450 on Stack Overflow See other posts from Stack Overflow or by user1207450
Published on 2012-03-08T10:03:54Z Indexed on 2012/04/12 11:29 UTC
Read the original article Hit count: 356

Following tests is automated by using java and selenium-server-standalone-2.20.0.jar.

The test crashes with the error:

Page title is: cheese! - Google Search
Starting browserTest
2922 [main] INFO org.apache.http.impl.client.DefaultHttpClient - I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
2922 [main] INFO org.apache.http.impl.client.DefaultHttpClient - Retrying request
Exception in thread "main" org.openqa.selenium.UnhandledAlertException: Modal dialog present (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.20 seconds
Build info: version: '2.20.0', revision: '16008', time: '2012-02-27 19:03:04'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_24'
Driver info: driver.version: InternetExplorerDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:170)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:129)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:438)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:139)
    at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:91)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:48)
    at com.pwc.test.java.InternetExplorer7.browserTest(InternetExplorer7.java:34)
    at com.pwc.test.java.InternetExplorer7.main(InternetExplorer7.java:27)

Test Class:

    package com.pwc.test.java;

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebDriverBackedSelenium;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.htmlunit.HtmlUnitDriver;
    import org.openqa.selenium.ie.InternetExplorerDriver;

    import com.thoughtworks.selenium.Selenium;

    public class InternetExplorer7 {
    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    WebDriver webDriver = new HtmlUnitDriver();
    webDriver.get("http://www.google.com");
    WebElement webElement = webDriver.findElement(By.name("q"));
    webElement.sendKeys("cheese!");
    webElement.submit();
    System.out.println("Page title is: "+webDriver.getTitle());
    browserTest();
}
    public static void browserTest() {
    System.out.println("Starting browserTest");
    String baseURL = "http://www.mail.yahoo.com";
    WebDriver driver = new InternetExplorerDriver();
    driver.get(baseURL);
    Selenium selenium = new WebDriverBackedSelenium(driver, baseURL);
    selenium.windowMaximize();
    WebElement username = driver.findElement(By.id("username"));
    WebElement password = driver.findElement(By.id("passwd"));
    WebElement signInButton = driver.findElement(By.id(".save"));
    username.sendKeys("myusername");
    password.sendKeys("magic");
    signInButton.click();
    driver.close();
    }
    }

I don't see any modal dialog when I launched the IE7/8 browser manually. What could be causing this?

© Stack Overflow or respective owner

Related posts about selenium

Related posts about internet-explorer-7