这是 HTML
<div class="bg_tv col-md-12 online"> <iframe width="100%" height="460" src="https://www.youtube.com/embed/dtKciwk_si4" scrolling="OFF" frameborder="0" allowfullscreen=""></iframe></div>
我试过:
browser.find_element(By.TAG_NAME, "iframe").get_attribute("src")
但我得到了:
no such element: Unable to locate element: {"method":"css selector","selector":"iframe"}
然后我尝试了 XPATH:
browser.find_element(By.XPATH,"/html/body/div/div[3]/div/div[2]/div[1]/iframe").get_attribute("src")
但也无法找到元素错误。有什么帮助吗?
慕工程0101907
月关宝盒
相关分类