Robot Framework Text Field Clearing and Inputting

Ksenia Starodubtseva picture Ksenia Starodubtseva · Jul 12, 2016 · Viewed 29.7k times · Source

I am automating a web page using Robot Framework. The page has unusual text fields that receive automatic input (not placeholder values) in case Enter is hit for invalid values.

Here is the text field:

I have tried handling with Input Text as well as Press Key. I am a beginner-programmer rather, so please forgive me my wording further on.

  • With Input Text: the behavior was as if I clicked on the field, cleared the content, hit Enter and then inputted the value.

  • With Press Key the behavior was as if I clicked on the field add just typed in input adding to what I was already contained.

Clear Element Text+Press Key worked the same way as Input Text.

I need a way to click on the text field, to remove the content, to not hit enter, to type in text, then hit enter.

How can I do this using RIDE Custom Libraries?

Thank you in advance for your effort.

Answer

Said026 picture Said026 · Jul 15, 2016

Have you tried with the keyword Clear Element Text :

 Clear Element Text  xpath=//input[@id='ember475']

More information here http://robotframework.org/Selenium2Library/doc/Selenium2Library.html#Clear%20Element%20Text