Selenium查看元素屬性


1.如果獲取圖片中的 src 值:
<img id="imgcorrelationId" class="profile-user-img img-responsiveimg-responsive img-circle" alt="User profile picture" style="margin-left: 35px" src="/image/12.png">
driver.find_element_by_xpath("//*[@id='imgcorrelationId']").get_attribute("src")

2.獲取 ifranme 中的 id 屬性值
<iframe id="download_zxbg" style="display: none" src=""></iframe>
driver.find_element_by_xpath("//*[@id='download_zxbg']").get_attribute("id")


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM