[Bug?] Trying to verify text?

Hallo All,

Banging my head on this one. Hopefully someone see what is going wrong here. The log looks perfect and nothing seems to fail but the test fails still and totally looks like it’s unexpected so could this be a bug?

What i try to do is the following.

1. Trying to get a value from a input field with storeEval since in other ways i can’t get it.
2. Then try to verify the text that is stored.

Try to execute the following:

storeEval | window.document.getElementsByName('name')[0].value; | name
verifyText | css=input[name="name"] | ${name}

Log:

[info] Executing: | storeEval | window.document.getElementsByName(‘name’)[0].value; | name |

[info] Store 'Social advertising, automated. ’ into ‘name’

[info] Executing: | verifyText | css=input[name=name] | ${name} |

[info] Expand variable ‘${name}’ into 'Social advertising, automated. ’

[error] did not match

I’m trying to get the value from the fields and try to verify this value but i can’t seen to succeed. Any ideas?

Thanks!

Patrick

Hi. I’ll check it tomorrow but I don’t think “input” elements have “text”. They have values and those values are always reflected on the UI. May I know what you are trying to achieve?

Alex said:

Hi. I’ll check it tomorrow but I don’t think “input” elements have “text”. They have values and those values are always reflected on the UI. May I know what you are trying to achieve?

Well the thing is i can see the text in the UI the problem is when i view the source i don’t see the values there that is why i tried to get the values the way i did in the example.

Now i want to verify the text stored is correct.

There are two ways to set values for an input:

  1. By using attribute “value”: (“content attribute”)
  2. By setting in JavaScript: element.value = “this is a value” (so-called “IDL attribute” - see also https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes#Content_versus_IDL_attributes)

Either way, “element.value” will return the value shown on GUI.

Therefore, you don’t need to worry about the source (HTML code) - just verifying “element.value” is enough.