使用Python的Selenium库从网站访问此值
我能够使用硒来创建驱动程序,并使用它登录此站点并加载此页面
< img src =“ https://i.sstatic.net/fakof.jpg” alt =“在此处输入图像说明”>
我应该如何尝试访问这个2.8±0.5值?我能够使用&lt; iframe&gt;
使用,
iframe = WebDriverWait(driver, timeout=10).until(EC.presence_of_all_element_located((By.TAG_NAME,'iframe')))
但是当我这样做时,
iframe.find_element(By.CLASS_NAME,'src')))
我无法获得任何东西。
如何获得此值有任何解决方法吗?我应该尝试先转到SRC链接吗? Selenium是正确的库吗?谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在找到其下的元素之前,您需要切换到
&lt; iframe&gt;
。您可以使用frame_to_be_available_and_switch_to_it
为此,您还可以使用
ID
或 name name by by,现在使用
> driver.find_element(...)
找到元素。要退出
&lt; iframe&gt;
使用driver.switch_to.default_content()
You need to switch to the
<iframe>
before locating elements under it. You can useframe_to_be_available_and_switch_to_it
for thatYou can also use the
id
orname
attributes withoutBy
And now use
driver.find_element(...)
to locate the element.To switch back out of the
<iframe>
usedriver.switch_to.default_content()