【问题标题】:Selenium throws error when swapping Iframe, PythonSelenium 在交换 Iframe、Python 时抛出错误
【发布时间】:2018-07-02 22:35:01
【问题描述】:

我正在尝试切换到另一个框架,但 Selenium 总是抛出错误:

代码:

ca_frame = driver.find_element_by_xpath('//iframe[@class="s1i518j4-2 bLslTo"]')
driver.switch_to.frame(ca_frame)

给我以下错误

WebDriverException:未知错误:调用函数结果丢失 “价值”(会话信息:chrome=67.0.3396.99)(驱动程序信息: 铬驱动程序=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),平台=Windows NT 10.0.17134 x86_64)

这是我从未见过的。问题是它使用 xpath 返回一个元素。

非常感谢任何帮助!

【问题讨论】:

    标签: python selenium


    【解决方案1】:

    从您的堆栈跟踪中,

    会话信息:chrome=67.0.3396.99)(驱动程序信息: chromedriver=2.32.498550

    您的 chrome 驱动程序非常旧,与此 Chrome 版本不兼容。如果您前往 chromedriver website,您会看到您应该使用 ChromeDriver 2.39 which Supports Chrome v66-68ChromeDriver 2.40 which Supports Chrome v66-68

    请更新 chromedriver,然后重试。如果xpath正确,应该可以跳转到frame。

    【讨论】:

      猜你喜欢
      • 2018-07-22
      • 2021-11-05
      • 2021-10-02
      • 1970-01-01
      • 2014-06-11
      • 2016-08-04
      • 1970-01-01
      • 2016-09-07
      • 1970-01-01
      相关资源
      最近更新 更多