m0_53872369
m0_53872369
采纳率0%
2021-05-05 08:26

ifarme.selenium切换

<iframe scrolling="auto" id="frm47a6f4df-da6f-42fd-92ca-32c1ba89817a" src="../../zlhrcdcs/construction/cdcs/pipelaying/cons_dcs_linecompletionpoint/query_cons_dcs_linecompletionpoint.html?roleId=null&amp;token=e4a9c3f5-6008-4af0-b2e3-6f5744772c2d" width="100%" height="100%" frameborder="no"></iframe>

 

 

iframe ID 这种情况下怎么 selenium 切换过来

 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • m0_53872369 m0_53872369 3天前
    iframe=driver.find_element_by_xpath('//*[@id="frm47a6f4df-da6f-42fd-92ca-32c1ba89817a"]')
    driver.switch_to.frame(iframe)
    time.sleep(5)

    这是我写的

    下面是报的错误

     

     

    selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of <iframe id="frm47a6f4df-da6f-42fd-92ca-32c1ba89817a" src="../../zlhrcdcs/construction/cdcs/pipelaying/cons_dcs_linecompletionpoint/query_cons_dcs_linecompletionpoint.html?roleId=null&token=e0e7fcdb-f1f9-473b-b44b-bf214d089534"> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed

     

    点赞 评论 复制链接分享

相关推荐