【问题标题】:How to use Iframes in python selenium?如何在 python selenium 中使用 iframe?
【发布时间】:2021-03-06 22:13:49
【问题描述】:

<iframe ng-repeat="contentFrame in contentFrames" src="/PrivateArea/MDL_Action/Default.aspx?rid=241&ifrsafe=1" class="tg_pageFrame ng-scope ng-isolate-scope" iframe-onload="contentFrame.pageNavigated()"></iframe>

如何在 python selenium 中切换到这个框架

我在 youtube 上观看了一些教程,在元素中使用了 control F 之后,这个 iframe 是 12 个 iframe 中的第 10 个

【问题讨论】:

    标签: python selenium selenium-webdriver webautomation


    【解决方案1】:

    如果有多个相同的帧,您可以按索引选择所需的帧:

    iframe = driver.find_elements_by_tag_name('iframe')[9]
    driver.switch_to.frame(iframe)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-30
      • 2017-07-27
      • 2017-07-05
      • 1970-01-01
      • 1970-01-01
      • 2018-01-21
      • 2023-03-07
      • 2021-03-16
      相关资源
      最近更新 更多