How to navigate in Robot framework
We will learn about how to build custom robot keyword and navigate between pages like backward or forward with working example.
What you will learn
- How to build robot keywords
- Navigate to links and back in robot
- Navigation example
How to build robot keywords
Keywords are actual test steps executed during the Test runs, Robot Framework has predefined keywords that are frequently used that are available in builtin library.
To get started with Robot Framework, follow this link.
For the web automation Robot Framework uses SeleniumLibrary.
Keyword - To open browser
Open Browser https://google.com/ chrome
Keyword - Maximize Browser Window
Maximize Browser Window
Keyword - Close the browser session
[Teardown] Close Browser
How to build custom keywords
Open chrome browser, goto https://google.com and maximize the browser window.
Open Browser To Google Open Browser https://google.com/ chrome Maximize Browser Window Set Selenium Speed 0
We have combined three builtin keywords and create custom keyword.
Keyword - Input Text Area
Input Search Input Text //input[@title="Search"] mobilelabs.in
Keyword - Navigate to back
This executes the history.back() JS api to push the browser to back.
Example - Test Case
- Open Browser and go to https://google.com
- Enter mobilelabs.in in google search input
- Hit search button
- View search results for the mobilelabs.in
- Go back to google home page
- Close the browser
We have seen how to navigate between pages using Robot framework. Coming up next building RPA using robot framework.
Please leave your comments below.