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
Go Back
Execute Javascript history.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
*** Settings ***
Documentation A test suite with a single test for opening google.com.
...
... This test has a workflow that is created using keywords in
... the imported resource file.
Library SeleniumLibrary
*** Variables ***
${SERVER} https://google.com/
${BROWSER} Chrome
${DELAY} 0
${SEARCHWORD} mobilelabs.in
*** Keywords ***
Open Browser To Google
Open Browser ${SERVER} ${BROWSER}
Maximize Browser Window
Set Selenium Speed ${DELAY}
Input Search
Input Text //input[@title="Search"] ${SEARCHWORD}
Submit Credentials
Press Keys None RETURN
Go Back
Execute Javascript history.back()
*** Test Cases ***
Open Google Home Page
Open Browser To Google
Input Search
Submit Credentials
Go Back
[Teardown] Close Browser
Output

Conclusion
We have seen how to navigate between pages using Robot framework. Coming up next building RPA using robot framework.
Please leave your comments below.