Is there any methods for python+selenium to find parent elements, brother elements, or child elements just like
driver.find_element_parent?
or
driver.find_element_next?
or
driver.find_element_previous
?
eg:
<tr>
<td>
<select>
<option value=0, selected='selected'> </option>
<option value=1, > </option>
<option value=2,> </option>
</select>
</td>
<td> 'abcd'
<input name='A'> </input>
<td>
<tr>
I've tried like below, but fail:
input_el=driver.find_element_by_name('A')
td_p_input=find_element_by_xpath('ancestor::input')
How can I get the parent of input element and then, finally, get the option selected?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…