您的位置:首页 > 编程语言 > Python开发

selenium+python自动化中 读取文本属性值和读取文本值

2016-03-14 15:09 218 查看
<body>
<span class="textbox" eid="cityUpdate" style="width: 278px; height: 22px;">
<input type="text" autocomplete="off" class="textbox-text validatebox-text" id="e-cityUpdate" placeholder="" style="margin-left: 0px; margin-right: 0px; width: 270px;">
<input type="hidden" class="textbox-value" value="北京">
</span>
<script>
console.log(document.getElementsByTagName("input")[1].value)
</script>
</body>

对应展示效果为:



这是用js实现的方法,读取的值是北京

另外用一种更加快速的方法是

browser.find_element_by_xpath(path).text


另外参杂点关于鼠标事件

需要引用的架包为:from webdriver.common.action_chains import ActionChains

具体的用法后续总结.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: