How to test for blank text field when using robotframework-selenium?

53,043

Solution 1

You can use either a single backslash \ or special variable ${EMPTY} to create an empty string in the test data. User guide has the details: Robot Framework User Guide.

Solution 2

Yes, ${EMPTY} is a built in variable.

There are many examples, see an example here

Share:
53,043
Chris Curvey
Author by

Chris Curvey

Updated on July 09, 2022

Comments

  • Chris Curvey
    Chris Curvey almost 2 years

    How can I specify blank/empty value for a text field when using the robotframework-seleniumlibrary with a TSV file? For example, I have the following:

    Textfield Value Should Be       identifier=name1       Chris
    Textfield Value Should Be       identifier=name2
    

    I want to test that name2 is blank. I have tried leaving it blank (which returns a message about an incorrect number of arguments. I have tried "", which looks for a pair of quotes, and '' which enters a single quote, and selenium seems to look for that

  • sdmythos_gr
    sdmythos_gr over 12 years
    ${EMPTY} should work very well and it will be easier understood when reading the test case again... I would try to avoid backslash...
  • Ripon Al Wasim
    Ripon Al Wasim about 11 years
    Yes, ${EMPTY} is more meaningful than \ (backslash)
  • Ripon Al Wasim
    Ripon Al Wasim about 11 years
    Is ${EMPTY} a built-in variable?
  • Dev
    Dev over 3 years
    Other way is to include the value attribute of element in the xpath and assert the xpath //input[@class='xyz' and @value='']