M.C.
M.C.

Reputation: 1

Robot Framework Input Text does not enter all text

I'm trying to enter a text into a message field using Input Key. Sometimes, it enters all characters and other times it gets cut off. I've tried using Press Key but it does the same thing. Is there another solution?

Example:

Press Key    id:noteMessage    This is a note from the Robot Framework

Upvotes: 0

Views: 3582

Answers (1)

Monnikje
Monnikje

Reputation: 21

What you could do, is insert a loop that runs for example a few times and tries each time to insert the text into the text field. During the loop you read the result of the text field, and if it matches the original text you try to input, you quit the loop.

For example something like:

${retries} = 3
${text} = "Some text that doesn't get fully displayed all the time."
${locator} = id:noteMessage
:FOR  element  IN RANGE   0            ${retries}
\     Input text          ${locator}   ${text}
\     ${inserted_text} =  Get text     ${locator}
\     ${result} =         Evaluate     ${inserted_text} = ${text}
\     Exit for loop if    ${result} = True

Of course you can insert quite a few more failsafes, but this should be a good basis. And of course you should look into the problem why the field doesn't inserted sometimes the key or text.

Upvotes: 0

Related Questions