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