FuckTheWorld / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Closing window fails after pageload timeout #1116

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Issue Description:
  chromedriver fails to close window (times out) if attempts to close it after a failed navigation.

  If another navigation attempt is made before attempting to close it, it's successful. Probably pending navigation handling is missing something.

Steps to reproduce:
  1. Run the script provided (test-closing-after-load-fail.js)
      The script does the following:
      1. Set page load timeout to 5 seconds
      2. Attempt to load http://123.123.123.123 (assuming this leads to nowhere)
      3. Close the window on timeout failure (of promise).

Script code:

    driver.manage().timeouts().pageLoadTimeout(5000);

    driver.get('http://123.123.123.123')
    .then(null, function () {
        console.log('closing');
        // Closing is successful only if the following command is uncommented.
        // driver.get('about:blank');
        driver.close().then(function () {
            console.log('closing ends');
        }, function (e) {
            console.error('Error', e);
        });
    });

Expected Result:
   Window is closed

Actual Result:
  Error { [UnknownError: unknown error: failed to close window in 20 seconds
    (Session info: chrome=43.0.2357.81)
    (Driver info: chromedriver=2.15.322455 (ae8db840dac8d0c453355d3d922c91adfb61df8f),platform=Mac OS X 10.9.5 x86_64)]
    code: 13,
    state: 'unknown error',
    message: 'unknown error: failed to close window in 20 seconds\n  (Session info: chrome=43.0.2357.81)\n  (Driver info: chromedriver=2.15.322455 (ae8db840dac8d0c453355d3d922c91adfb61df8f),platform=Mac OS X 10.9.5 x86_64)',
    name: 'UnknownError', …<removed>…

Original issue reported on code.google.com by chris.si...@gmail.com on 4 Jun 2015 at 5:10

Attachments:

GoogleCodeExporter commented 8 years ago
This issue is reproducible, Tested with latest version of ChromeDriver(2.15), 
Chrome(v43) and Selenium(2.45)

-------------- java --------------

    ChromeDriverService service = new ChromeDriverService.Builder()
                              .usingDriverExecutable(driverpath)
                              .usingAnyFreePort()
                              .withVerbose(true)
                              .withLogFile(logfile)
                              .build();
        service.start();
        WebDriver driver=null;
    try {
        driver = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.chrome());
        driver.manage().timeouts().pageLoadTimeout(3, TimeUnit.SECONDS);        
        driver.get("http://123.123.123.123");
        } 
    catch (Exception e) {
             System.out.println(e.getMessage());
        }
           // Closing is successful only if the following command is uncommented.
           // driver.get("about:blank");
            driver.close();
            System.out.println("Driver.Close");
            driver.quit();
            System.out.println("Driver.quit");

        if (service.isRunning())
        service.stop();   

Original comment by agau...@chromium.org on 8 Jun 2015 at 11:34

GoogleCodeExporter commented 8 years ago

Original comment by gmanikp...@chromium.org on 10 Jun 2015 at 12:02