[英]How to extract XPATH or CSSPath from a web element in selenium java
我想将值提供给没有名称,ID或类的输入字段。
<form class="formclass">
<input type="text">
<input type="password">
</form>`
试试XPath
//form[@class="formclass"]/input[@type="text"]
//form[@class="formclass"]/input[@type="password"]
或CSS
选择器
form.formclass input[type="text"]
form.formclass input[type="password"]
请尝试以下
xpath:
(//form[@class='formclass]//input)[0]
(//form[@class='formclass]//input)[1]
CSS:
.formclass input[type='text']
.formclass input[type='password']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.