Selenium python - leaving the popup hanging

I want to emulate the following behavior in selenium python (python v2.7, selenium v3.4.2, geckodriver):

  • Click the link on the page that opens the popup

  • Select the link in the pop-up window and click on it

  • Do something else in the main window

I have the following code:

main_window_handle = None
while not main_window_handle:
    main_window_handle = driver.current_window_handle
driver.find_element_by_xpath('//*[@title="Open Search Window"]').click()
search_window_handle = None 
while not search_window_handle:
    for handle in driver.window_handles:
        if handle != main_window_handle:
            search_window_handle = handle
            break
driver.switch_to.window(search_window_handle)
driver.switch_to.frame("resultsFrame")
print "Clicking results frame"
driver.find_element_by_link_text("TestResult").click()
print "Expecting window to close"
driver.switch_to.window(main_window_handle)

      

It works to open a popup, select a frame, and link to that frame. The popup is closed (that's correct), but the selenium hangs after that and the print assertion with "Waiting for window to close" is never executed. It is especially strange that selenium never overheats and lasts until the process is manually interrupted.

EDIT:

It looks like it might be a geckodriver issue, I ran the code with chromedriver and it worked.

+3
python selenium geckodriver


source to share


No one has answered this question yet

Check out similar questions:

5504
Does Python have a ternary conditional operator?
5231
What are metaclasses in Python?
4473
Calling an external command in Python
3790
How can I safely create a subdirectory?
3602
Does Python have a substring method "contains"?
3119
What is the difference between Python list methods that are appended and expanded?
2818
Finding the index of an element by specifying the list that contains it in Python
2568
How to find the current time in Python
2453
How do I install pip on Windows?
1329
How to logout / logout / disable Python virtualenv



All Articles
Loading...
X
Show
Funny
Dev
Pics