问题
Currently i'm using selenium 3.6 with IE web driver version as 3.4.
There is an area in my application where i have to click on a button which downloads an excel.When i do this in IE using selenium it opens a new window of IE (not happening when you do manually) along with normal download pop up.
When i tried to identify the other window which was opened, using window_handles method in python i'm not able to identify the other window as the window_handles is only identifying the main window.
Config details: IE version 11.17 Windows 10 language :python 3.4
回答1:
I had a similar problem with IE8. I had should do a switch to default content, before use the window_handles. That way identify more windows.
I know you are using Python, but the Java code for this is:
// Take the parent id before change
String parent = driver.getWindowHandle();
for (String winHandle : driver.getWindowHandles()) {
driver.switchTo().window(winHandle);
if (!winHandle.equals(parent)) {
driver.close();
}
}
driver.switchTo().window(parent);
I think the steps are the same on Python.
来源:https://stackoverflow.com/questions/46966305/selenium-with-ie11-does-not-identify-the-other-window-opens-using-windows-handle