[英]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.