How can I get the text node of an element in robot framework with selenium2library?

11,739

To get the text within a dom element, you need to use getText(). You are specifying getValue() which is synonymous with getAttribute("value").

Since your <span> element reveals text by it's innerHTML, instead of a value attribute, use getText()

Share:
11,739
Rocky Wang
Author by

Rocky Wang

Updated on June 15, 2022

Comments

  • Rocky Wang
    Rocky Wang almost 2 years
    <span id="spanHome" class="where-are-we" style="background-color: transparent;"> Home </span>
    

    I want to get "Home" and returned. Which keyword should I use?

    I tried:

    ${value}= Get Value //span[@id='spanHome']
    

    But I always get None.

  • Rocky Wang
    Rocky Wang over 10 years
    That's great. Thanks.