How to get value from UI?

I am new at Robot framework
I want to fetch one number from ui
in html
<h count (1234) >h

${count} = Get Text ${loc_count}
Log To Console ${count}
but in log i get count = 0

Hi Pratik,

This doesn’t look like valid html? are you sure this is what it looks like (screen shot of the html in dev tools?)

<h count (1234) >h

Perhaps it looks like this?

<h count="1234"></h>

Or this?

<h attributename="count(1234)"></h>

The next part to your question, you didn’t mention which library you are using? SeleniumLibrary or Browser Library?

Either way, Get Text is for getting the text content of the html not the attribute text, consider the example below:

<div id="acb123" value="my special value">My Example Text</div>

If you wanted the text My Example Text you would use Get Text, but if you wanted my special value or acb123, then you need to get the attribute not the text, with either Get Element Attribute or Get Attribute depending on which library you are using.

If getting the attribute then gave you back a string like count(1234) you would then need to further process it with something like Get Substring or one of the other keywords from String Library.

Hope that helps,