[Python] Find XPath of an element from text contained within a div in Robot Framework

Discussão em 'Python' iniciado por Stack, Fevereiro 5, 2025.

  1. Stack

    Stack Membro Participativo

    I need to retrieve the XPath of an element on a page, but all I know about the element is that it will contain a certain string, let's say "required text" and that it will sit in a div. I would like to search the page for this string and return the XPath to this div.

    I have tried something like:

    ${findXPath} = Get Element Attribute //*[contains(text(),'required text')] xpath


    but this returns nothing.

    Continue reading...

Compartilhe esta Página