【发布时间】:2018-07-19 18:16:20
【问题描述】:
我想获取 iframe 标签下的所有 html 内容(例如所有 xxxx),如果 html 是这样的:
<body>
<div></div>
....
<div class = A>
<div class=B>
<div class = C>
<iframe class = D>
xxxxxxx
</iframe>
</div>
</div>
</div>
html = driver.switch_to.frame(driver.find_element_by_xpath("//iframe[@class='D']"))
我试过这样的代码,这个代码有什么问题吗?错误信息是:
错误消息:
Unable to find element with xpath
【问题讨论】:
-
您需要先切换到框架,然后获取其中的所有元素
标签: selenium selenium-webdriver iframe webdriverwait