-1
下面是代碼。有人可以幫助我單獨標識3個文本框,而不使用索引。如何識別第一,第二和第三個文本框而不使用索引(例如[1]) - xpath,selenium
<html>
<head>
<title>test</title>
<script></script>
</head>
<body>
name:
<input type="text"/>
<br/>
name:
<input type="text"/>
<br/>
name:
<input type="text"/>
<div>testdiv</div>
</body>
</html>
你所有的3個元素是相同的所以它只能夠間接使用像'// input [1]'這樣的索引,如果你可以使用像'// input [last()]這樣的函數' - 它會找到最後一個輸入標籤' // input [last() - 1]' - 它會找到第二個輸入標籤或者使用'position()' - '// input [position()= 1]'等等 – NarendraR
您的業務需求是什麼?爲什麼你想避免索引? – DebanjanB
顯示你如何試圖解決你的問題 – Andersson