0

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

Zee
  • 1
  • 1

1 Answers1

0

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.

j.barrio
  • 1,006
  • 1
  • 13
  • 37
  • Thanks for the comment.Will try it out and let you know – Zee Oct 27 '17 at 09:16
  • j.barrio it did work out.But the problem is when i try to close the window new window after switching to it, it throwing NoSuchWindowException. – Zee Oct 27 '17 at 10:22
  • This is code which i followed: ################################### self.driver.switch_to_default_content(); temparr=self.driver.window_handles; self.driver.switch_to_window(temparr[1]); self.driver.close(); – Zee Oct 27 '17 at 10:23