使用python处理selenium中的frame切换问题

# iframe有name或id值

self.driver.switch_to.frame('iframe-name-id')

# iframe没有name或id值

xf = self.driver.find_element_by_xpath('//iframe[@allowtransparency="true"]')

self.driver.switch_to.frame(xf)

# 跳出当前iframe

self.driver.switch_to.parent_frame()

# 返回最外层iframe

self.driver.switch_to.default_content()

posted @ 2017-12-13 15:23  alsoalso  阅读(8083)  评论(2编辑  收藏  举报