internet explorer - Dealing with Frames - Python Webdriver -


i have following code looking 2 frames , clicks link.

this code works in chrome , firefox. in ie though tests sit on page , never @ all. in safari, error frame doesn't exist hogwash, can see in safari developer tools. wondering how make work across browsers.

try:     iframe = driver.find_element_by_id('ifrm')     driver.switch_to_frame(iframe)     print "navigated ifrm frame" except:     raise invalidswitchtotargetexception(msg="couldn't find ifrm frame") try:     nav_frame = driver.find_element_by_id('nav')     driver.switch_to_frame(nav_frame)     print "navigated nav frame" except:     raise invalidswitchtotargetexception(msg="couldn't find nav frame") 

an explicit wait for frame become present can in case of safari:

from selenium.webdriver.common.by import selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec  ...  wait = webdriverwait(browser, 10) frame = wait.until(ec.presence_of_element_located((by.id, 'ifrm')))  driver.switch_to_frame(frame) 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -