Chrome version: 80.0.3987.149 Selenium version: 3.141.0
The idea behind program is to open new window with video, collect information from confirmation box (automatically appears when window is opened) and accept the confirmation. Problem is that program hangs when new window appears.
try:
browser.find_element_by_xpath("//*[contains(text(), 'VOD')]").click()
except NoSuchElementException:
continue
main_handle = browser.current_window_handle
for handle in browser.window_handles:
if handle != main_handle:
browser.switch_to.window(handle)
print('I switched to: %s' % (browser.current_window_handle)) # this line is not printed
try:
WebDriverWait(browser, 3).until(EC.alert_is_present())
alert = browser.switch_to.alert
alert_text = alert.text
alert.accept()
except Exception as e:
print('Exception: ', e)
Aucun commentaire:
Enregistrer un commentaire