Reputation: 129
When I click a button open new window How do I know window open finished?
In wait frame can I use below
wait.until(EC.frame_to_be_available_and_switch_to_it(driver.find_element_by_name('newframe')))
in new window?
Upvotes: 0
Views: 1816
Reputation: 16201
You can find the count of the current(before) window handles and get after windows handles and implement lambda
to wait for them NOT to be equal. I am not familiar with 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 this answer on similar topic.
Upvotes: 1