How to locate the web element via sibling in python?


How to locate "check"in selenium, which corresponds to a button I need to click?

I can not locate it directly. I have to use id='animal'. There is no error if I try below, but there is no response.


1 answer

  • answered 2018-01-14 08:54 Andersson

    You can use XPath


    or modify your code as


    Note that I replaced //input which means input node somewhere on the page (returns the first found input in DOM) with ./input which means input node that is child of current node (returns the first found input in target div)