ericmckean / chromedriver

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

Commands on closed window #938

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Selenium gives incorrect error when attempting to execute commands on a window 
that has been closed

Open 2nd window
switch to 2nd window with driver
close 2nd window
make a call on the driver (e.g. driver.current_url)

This should throw:
  Selenium::WebDriver::Error::NoSuchWindowError

instead it (eventually) gives:
  Net::ReadTimeout: Net::ReadTimeout

Failing test that can be run in watirspecs project:
https://gist.github.com/titusfortner/4c9c489598bbb0d852b4#file-current_code

Original issue reported on code.google.com by titusfor...@gmail.com on 16 Oct 2014 at 1:22

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:18

GoogleCodeExporter commented 9 years ago
I am not able to reproduce the problem . Code is as follows:-

WebDriver driver = new ChromeDriver();
driver.get("http://google.com/");
 Actions actions = new Actions(driver);
WebElement nextButton = 
driver.findElement(By.linkText("Images"));          Thread.sleep(3000);
                actions.keyDown(Keys.CONTROL).click(nextButton).keyUp(Keys.CONTROL).build().perform();
Set <String> wins = driver.getWindowHandles();
Iterator <String> itr = wins.iterator(); 
String parentwin = itr.next();
String childwin = itr.next();
driver.switchTo().window(childwin);
driver.close(); // closes the 2nd  window
driver.getCurrentUrl();

It throws correct error - 
 org.openqa.selenium.NoSuchWindowException: no such window: target window already closed

Please let me know if it differs from what you are doing

Original comment by gmanikp...@chromium.org on 2 Mar 2015 at 10:49

GoogleCodeExporter commented 9 years ago

Original comment by gmanikp...@chromium.org on 30 Mar 2015 at 9:39