Python硒进入#document内 [英] Python selenium get inside a #document
本文介绍了Python硒进入#document内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何继续在#document中寻找元素:
How can I keep looking for elements in a #document:
<div>
<iframe>
#document
<html>
<body>
<div>
Element I want to find
</div>
</body>
</html>
</iframe>
</div>
推荐答案
我认为您的问题不是a#
文档,而是iframe
.
I think your problem is not with the a#
document but with iframe
.
from selenium import webdriver
driver = webdriver.Firefox()
iframe = driver.find_elements_by_tag_name('iframe')[0]
driver.switch_to_frame(iframe)
driver.find_element_by_xpath("//div")
这篇关于Python硒进入#document内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文