所有元素都是動態的。我只能看到佔位符是從以下HTML獨特: -如何使用xpath從佔位符中獲取值
<input
id="ext-gen1617"
type="text"
size="20"
class="x-form-field x-form-text x-form-focus"
autocomplete="off"
aria-invalid="false"
placeholder="Gender"
data-errorqtip=""
role="textbox"
aria-describedby="combobox-1166-errorEl"
aria-required="true"
style="width: 78px;"
/>
我需要顯示在
placeholder="Gender".
值我嘗試使用
//input[@placeholder='Gender']
但我的webdriver腳本未能識別它。
任何人都可以請幫助我解決這個問題嗎?
你得到了什麼錯誤?司機是在正確的框架? – Karthikeyan
org.openqa.selenium.NoSuchElementException:找不到xpath == // *的元素[@ placeholder ='Gender'] – user2572510
這個錯誤有很多種可能性,如果你的情況不適合這裏http:// stackoverflow .com/questions/17677587 /無法找到元素與Xpath/17695301#17695301,然後讓我知道,我們可以進一步挖掘 – Karthikeyan