So I have this element in html:
<input data-v-72dea36a="" type="text" name="tradelink" placeholder="Enter your code" style="margin-right: 25px;">
How can I select exactly this one? I tried:
find_element_by_name('tradelink')
There is another element before this one with the same name...it doesn't have an id or class name...
If there are just 2 elements with attribute name="tradelink"
, and assuming you need the seconds one, you can use:
find_elements_by_name('tradelink')[1]
Another way is using xpath
to match the placeholder
value:
find_element_by_xpath("//input[@placeholder='Enter your code']")
Notes:
find_elements_by_name('tradelink')[2]
Rightclick the element within the inspect element editor and select copy full xpath. As posted above, paste that code into the parentheses in find_element_by_xpath()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.