0

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?

2 Answers 2

3

Try to use below XPath :-

//li[@onclick='show_some_unique_action()']

Hope it will help you :)

Sign up to request clarification or add additional context in comments.

Comments

0

Use the below xpath to locate the element

//*/li[contains(concat(' ', @onclick, ' '), ' show_some_unique_action() ')]

It will locate the element.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.