How to close the pop up window in selenium running?
I wanna close the pop up window (known开发者_如何学Python window name), and back to the original window. What shall I do? If I can't get a constant of the close button in window. so is there any general behavior to reach the goal?
Using WebDriver (shown with Java) you could do something like this:
// instantiate your driver
...
// get window handle
String baseWindowHdl = driver.getWindowHandle();
// navigate to pop-up
...
// close pop-up
driver.close();
// switch back to base window
driver.switchTo().window(baseWindowHdl);
Have you tried:
selenium.Close();
selenium.SelectWindow("null");
I dont know if you are still looking for an answer, but i had some troubles with this. After spending more than one hour on searching for a way to do it, dont want to use webdriver. I tried using the garbage collector:
Selenium selenium = new DefaultSelenium(......);
selenium.start();
................
selenium.close(); //to terminate testing window
selenium = null; //make sure there are no references to the file
System.gc(); //now the garbage collector can kick in
This worked for me.
精彩评论