Selenium frame

  • browser.switch_to.frame(0)
    切換到第一個 frame。
  • browser.execute_script("return location.href")
    讀取此frame的 url。
  • browser.switch_to.default_content()
    切換到原始網頁。
  • browser.switch_to.parent_frame()
    回到上一層 frame,回到最上層後就一直停在最上層,不會有錯誤發生。

Reference

留言