使用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()


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM