examples for SeleniumLibrary's Get commands

1,292 views
Skip to first unread message

ElizaLeong

unread,
Feb 28, 2012, 6:54:20 PM2/28/12
to robotframework-users
I'm looking to retrieve values from text fields and tables by using
Get Table Cell, Get Text keywords. I haven't found a good example of
calling these Get commands and saving the returned values. Can anyone
provide a small code sample or helpful link here?
I'm also looking for a way to check for empty strings (ex. I'd Get
Text from a text field, and if it's empty then the test passes.)

Thanks!

Koyate, Sushant

unread,
Feb 28, 2012, 7:41:45 PM2/28/12
to elc....@gmail.com, robotframework-users
hello

I would try something like this

---------------------------------------------------
Verify TextField
  ${text}  Get Text  "your locator"
  Run Keyword If  '${text}' == ''  Log  test case passed
----------------------------------------------


OR

you can also use keyword --- 


----------------------------------------------
Textfield Value Should Be   locator, expected
-----------------------------------------------
where expected you can set a variable to empty

or
-------------------------------------------------------------------
Element Text Should Be    locator, expected
---------------------------------------------------------------------
where expected you can set a variable to empty


upto you.

let me know if that works

_Sushant


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To post to this group, send email to robotframe...@googlegroups.com.
To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.


ElizaLeong

unread,
Feb 28, 2012, 8:29:36 PM2/28/12
to robotframework-users
It worked!

My solution was:
| Log passed |
| | Log | Pass |
| Log failed |
| | Log | FAIL |
| Check Empty Email |
| | ${result} | Get Text | email |
| | Run Keyword If | '${result}' == '' | Log passed |
| | Run Keyword Unless | '${result}' == 'unexp...@gmail.com' | Log
failed |


Thanks for pointing me to BuiltIn!

Koyate, Sushant

unread,
Feb 29, 2012, 1:24:37 AM2/29/12
to elc....@gmail.com, robotframework-users

I would change it to below, if I want to FAIL my Test case for any other values I encounter, except it being empty. But not be dependable on 'unexp...@gmail.com'. It similarly works as IF-ELSE loop construction as stated in BuiltIn.


My solution was:
| Log passed    |
|               | Log | Pass    |
| Log failed    |
|               | Log | FAIL    |
| Check Empty Email     |
|               | ${result}     | Get Text | email |
|               | Run Keyword If        | '${result}' == '' |  Log passed  |
|               | Run Keyword Unless    | '${result}' == '' |  Log failed  |

_Sushant
Reply all
Reply to author
Forward
0 new messages