There is a li element which I want to select and it has only this information:
<li onclick="show_some_unique_action()"></li>
How can I do this in python and selenium? Is it possible to select the li that has an onclick attribute with text containing show_some_unique_action?
Try to use below XPath :-
//li[@onclick='show_some_unique_action()']
Hope it will help you :)
Use the below xpath to locate the element
//*/li[contains(concat(' ', @onclick, ' '), ' show_some_unique_action() ')]
It will locate the element.
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.