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

此生再无相见时 提交于 2019-12-08 03:23:42

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/19831271/how-can-i-get-the-text-node-of-an-element-in-robot-framework-with-selenium2libra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!