Find next/closest button Selenium
You can use in.get_attribute('id')
to retrieve the id
.
Alternatively, you can also select the following-sibling::button
of a given element using an XPath:
in.find_element_by_xpath(".//following-sibling::button").click()
Explanation:
.
- Selects the current node (<input>
)//
- Selects nodes in the documentfollowing-sibling::button
- where siblings after the current node is a<button>