Selenium: Pop-up Testing

I have a problem while trying to test a web application using Selenium / Python. Basically, I cannot test popup window elements.

Scenario: I can check all the elements for the page. But when I click on the button that opens a small popup, I can’t check the items in the popup. It looks like a popup window out of focus or in active mode.

I can check the items on the next page. For example, click the button to go to the next page, and I can work with the elements on the next page. So the problem seems to pop up.

I could post the code, but to be honest, it might be confusing at this point. I can post the code in a later post, thanks

+5
source share
2 answers

There is a property called switch_to

Q: How to handle pop-ups?

A: WebDriver offers the ability to handle multiple windows. This is done using a method WebDriver.switch_to.window(knownName)to switch to a window with a known name.

If the name is unknown, you can use WebDriver.window_handlesto get a list of known windows.

You can pass a handle switch_to.window(handleName)

For example, I used driverName.switchTo.window(driverName.getWindowHandle())to capture pop-ups for which I did not want to search for names.

Additional links: http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions

+6
source

Selenium RC API SelectWindow . ( JavaScript window.open()), . , SelectWindow(None).

0

All Articles