![](/img/trans.png)
[英]How do I obtain the text in a <p> tag contained by an iframe using Selenium with Python?
[英]How to obtain iframe source using Selenium [Python]
因此,對於 iframe,以下 HTML 看起來像這樣
<div class="main-iframe-page front-goal-view">
<iframe src="https://....cpp=44343645233" frameborder="0" style="height: 1304px;"></iframe>
這個 iframe 沒有“id”或“名稱”,所以我不確定如何訪問它,但有沒有辦法提取 src?
iframe 是一個與任何其他元素一樣的元素,您可以使用與任何其他元素相同的邏輯
例如:
frame = driver.find_element_by_xpath('//div[@class="main-iframe-page front-goal-view"]/iframe')
driver.switch_to.frame(frame)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.