First project
The video for this lecture is at the end of this page
Libraries
Libraries extend Robot Framework capabilities
Used in the first exercise:
•SeleniumLibrary – allows to work with elements on a web page
Basic Keywords
Open Browser
•open browser URL browser
•open browser google.com chrome
Close Browser
Maximize Browser Window
Input Text
•input text locator text
•input text id=email [email protected]
Click Button
/ Click Element
•click element css=input[name="submit"]
Wait Until
...
•wait until element is visible id=username timeout=5s
•wait until element is not visible id=loader timeout=5s
•wait until element contains css=h1 text timeout=5s
Sleep
•sleep 5s
Element Should Contain
•element should contain locator text
Assertions
•Basic rule: a test without assertion is not a test!
•Assertion is a comparison of actual result with expected result
•Statement expected to be true
Wait vs Sleep
Wait Until Element Is Visible
•Set Robot Framework to wait until given element appears on the page
•Generally preferable over Sleep
Sleep
•Sets test to "sleep" for given time
•Should not be used for waiting for elements to load
•Use only in exceptional cases and always comment on why!
Test execution
1.Open Terminal window in PyCharm:
•View -> Tool Windows -> Terminal
•Or open a command line window and navigate to your project folder
2.Type in "robot path\to\mytest.robot" and hit Enter
•where path\to\mytest.robot is relative path to your file with test cases
•you can also run all tests in a folder at once: "robot ." or "robot myfolder"
Exercise goals
- Create our first project
- Create our first automated test case
- Use basic keywords
- Use assertions
- Execute the test
Test Case
In this video for solving this task, we are using the test site https://automationexercise.com/products instead of Ebay.com