Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

<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.

like image 578
Rocky Wang Avatar asked Nov 18 '25 11:11

Rocky Wang


1 Answers

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

like image 161
ddavison Avatar answered Nov 21 '25 01:11

ddavison