python selenium webdriver open new window handle wait -


when click button open new window how know window open finished?

in wait frame can use below

wait.until(ec.frame_to_be_available_and_switch_to_it(driver.find_element_by_name('newframe'))) 

in new window?

you can find count of current(before) window handles , after windows handles , implement lambda wait them not equal. not familiar such/similar build in selenium mechanism.

def wait_for_new_window(driver, timeout=10):         handles_before = driver.window_handles         yield         webdriverwait(driver, timeout).until(             lambda driver: len(handles_before) != len(driver.window_handles)) 

see answer on similar topic.


Comments