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 :)

      0

      Use the below xpath to locate the element

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

      It will locate the element.

        Start asking to get answers

        Find the answer to your question by asking.

        Ask question

        Explore related questions

        See similar questions with these tags.