Unable to verify text in a given field

Hi Team,

I am facing some issues verifying a text in a particular field.

I need to verify if the text in the screenshot below is “12”, but when I use the keywords below, it fails.

${value}		Get Text       	    //*[@id='session-cache-timeout']//input   /*does not return any text
Element Text Should Be         //*[@id='session-cache-timeout']//input    12     /*fails

And I don’t see any text in the HTML code of my application, I guess the selenium keywords are failing because of that.

Is there a way to verify this? Please help

Could you try:

${input_value}   get element attribute    ${locator}      value
${input_name}   get element attribute     ${locator}      name

Thanks

1 Like

It worked, Thank you :slightly_smiling_face: @_daryl

2 Likes

In SeleniumLibrary Get Value has to be used to get the text that someone typed into an <input> element

Get Text returns the Text that is inside an html tag.

Example:
<div>MyText</div> could bet fetched by Get Text keyword.

3 Likes

Oh nice one, didn’t see that …definitely a nicer approach than above for value or text, but I guess it returns the same.

1 Like