# 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()