The use of iframe in selenium

#coding=utf8
from selenium import webdriver



dr = webdriver.Chrome()
#Switch to iframe, it can be name or id, or you can use index directly,
 dr.switch_to.frame( 0 )

#You can directly locate the iframe by finding various attributes of the iframe
 dr.switch_to.frame(dr.find_element_by_tag_name( "iframe" ))

 
 
#Generally, it is necessary to switch to the main html
 dr.switch_to.default_content()

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325842156&siteId=291194637