The essence of what. There is a web page, I want to select the input field using selenium. First one, then the second. But they have the same class, the same divs. How to be in this case? I tried to specify which particular div I need with the help of the index [0] and 1 through xpath. But it does not work, it gives an error.
<div class="xdsoft_autocomplete" style="display: inline-block; width: 170px;"> <input data-id="" data-value="" type="text" class="nostyle str_obj xdsoft_input" value="" placeholder="Откуда?" style="font-size: 14.7px; background: transparent none repeat scroll 0% 0%;" autocomplete="off"><div There are two such "divas" and two of the same input, each within each diva. How to choose the first, then the second?
Attached the screen. Everything is stored in div id routers, they have two route typeaheaded diva, and it contains input that I need
My code is:
addr_to = driver.find_element_by_xpath("//div[@id='routers']/input[contains(@class='nostyle str_obj xdsoft_input')]") It gives an error, even with the index [0], even without it. I can not understand what I am doing wrong
first-childornth-of-typefor example) ... IMHO, the perception of css selectors is much easier than xpath, respectively, easier to debug. - Bogdan