
Install Python
Install Pycharm IDE
Install Selenuim
Install robot framework
Install Robotframework Selenium Library
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${browser} chrome
${url} https://demo.nopcommerce.com/
*** Test Cases ***
LoginTest
open browser ${url} ${browser}
loginToApplication
close browser
*** Keywords ***
loginToApplication
click link xpath://a[@class='ico-login']
input text id:Email pavanoltraining@gmail.com
input text id:Password Test@123
click element xpath://input[@class='button-1 login-button']
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${browser} chrome
${url} https://demo.nopcommerce.com
*** Test Cases ***
TestingInputBox
open browser ${url} ${browser}
maximize browser window
title should be nopCommerce demo store
click link xpath://a[@class='ico-login']
${"email_txt"} set variable id:Email
element should be visible ${"email_txt"}
element should be enabled ${"email_txt"}
input text ${"email_txt"} JohnDavid@gmail.com
sleep 5
clear element text ${"email_txt"}
sleep 3
close browser
*** Keywords ***
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${browser} chrome
${url} http://www.practiceselenium.com/practice-form.html
*** Test Cases ***
Testing Radio Buttons and Check Boxes
open browser ${url} ${browser}
maximize browser window
set selenium speed 2seconds
# Selecting Radio buttons
select radio button sex Female
select radio button exp 5
#Selecting Check Box
select checkbox BlackTea
select checkbox RedTea
unselect checkbox BlackTea
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${browser} chrome
${url} http://www.practiceselenium.com/practice-form.html
*** Test Cases ***
Handling DrpDowns and Lists
open browser ${url} ${browser}
maximize browser window
select from list by label continents Asia
sleep 3
select from list by index continents 5
#select from list by value continents value
#list box
select from list by label selenium_commands Switch Commands
select from list by label selenium_commands WebElement Commands
sleep 3
unselect from list by label selenium_commands Switch Commands
Selenium Speed
Selenium Timeout
Implicit wait
Sleep
▪How To close Single & Multiple Browsers
▪How to Handle Alerts
▪How to Handle Frames
▪How to Handle Tabbed Windows
▪How to Handle Browser Windows
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
NavigationTest
open browser https://www.google.com/ chrome
${loc}= get location
log to console ${loc}
sleep 3
go to https://www.bing.com/
${loc}= get location
log to console ${loc}
sleep 3
go back
${loc}= get location
log to console ${loc}
sleep 3
close browser
▪Capture Element Screen Shot
▪Capture Page Screen Shot
Script
--------------------------------
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
LoginTC
open browser https://opensource-demo.orangehrmlive.com/ chrome
maximize browser window
input text id:txtUsername Admin
input text id:txtPassword admin123
#capture element screenshot xpath://*[@id="divLogo"]/img C:/Users/admin/PycharmProjects/Automation/logo.png
#capture page screenshot C:/Users/admin/PycharmProjects/Automation/LoginTC.png
capture element screenshot xpath://*[@id="divLogo"]/img logo.png
capture page screenshot LoginTC.png
▪Right Click
▪Double Click
▪Drag & Drop
Script
---------------------
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
MouseActions
#Right click/open open context menu
open browser http://swisnl.github.io/jQuery-contextMenu/demo.html chrome
maximize browser window
open context menu xpath://span[@class='context-menu-one btn btn-neutral']
sleep 3
#Double click action
go to https://testautomationpractice.blogspot.com/
maximize browser window
double click element xpath://button[contains(text(),'Copy Text')]
sleep 3
#Drag and Drop
go to http://www.dhtmlgoodies.com/scripts/drag-drop-custom/demo-drag-drop-3.html
maximize browser window
drag and drop id:box6 id:box106
sleep 5
close browser
▪Count Number of Links on Web Page
▪Extract All the Links from Page
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
TableValidations
open browser https://testautomationpractice.blogspot.com/ chrome
maximize browser window
${rows}= get element count xpath://table[@name='BookTable']/tbody/tr
${cols}= get element count xpath://table[@name='BookTable']/tbody/tr[1]/th
log to console ${rows}
log to console ${cols}
${data}= get text xpath://table[@name='BookTable']/tbody/tr[5]/td[1]
log to console ${data}
table column should contain xpath://table[@name='BookTable'] 2 Author
table row should contain xpath://table[@name='BookTable'] 4 Learn JS
table cell should contain xpath://table[@name='BookTable'] 5 2 Mukesh
table header should contain xpath://table[@name='BookTable'] BookName
close browser
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
ScrollingTestr
open browser https://www.countries-ofthe-world.com/flags-of-the-world.html chrome
maximize browser window
#execute javascript window.scrollTo(0,1500)
#scroll element into view xpath://*[@id="content"]/div[2]/div[2]/table[1]/tbody/tr[105]/td[1]/img
execute javascript window.scrollTo(0,document.body.scrollHeight)
sleep 3
execute javascript window.scrollTo(0,-document.body.scrollHeight) # starting position
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${url} http://www.newtours.demoaut.com/
${browser} chrome
*** Test Cases ***
TC1
open browser ${url} ${browser}
maximize browser window
input text name:userName mercury
input text name:password mercury
*** Keywords ***
#############################################
# Creating User Defined Keywords with NO Argument
#############################################
*** Test Cases ***
TC1
launchAppication # User defined Keyword with NO Argument
input text name:userName mercury
input text name:password mercury
*** Keywords ***
launchAppication
open browser ${url} ${browser}
maximize browser window
#############################################
# Creating User Defined Keywords with Argument
#############################################
*** Test Cases ***
TC1
launchAppication ${url} ${browser} # User defined Keyword with Aurguments
input text name:userName mercury
input text name:password mercury
*** Keywords ***
launchAppication
[Arguments] ${appurl} ${appbrowser}
open browser ${appurl} ${appbrowser}
maximize browser window
#############################################################
# Creating User Defined Keywords with Argument & Return Value
##########################################################
*** Test Cases ***
TC1
${pageTitle}= launchAppication ${url} ${browser} # User defined Keyword with Aurguments
log to console ${pageTitle}
log ${pageTitle}
input text name:userName mercury
input text name:password mercury
*** Keywords ***
launchAppication
[Arguments] ${appurl} ${appbrowser}
open browser ${appurl} ${appbrowser}
maximize browser window
${title}= get title
[Return] ${title}
#############################################################
# Creating User Defined Keywords with Argument & Return Value in Resources File
##########################################################
##### Resources.robot ####
*** Settings ***
Library SeleniumLibrary
*** Keywords ***
launchAppication
[Arguments] ${appurl} ${appbrowser}
open browser ${appurl} ${appbrowser}
maximize browser window
${title}= get title
[Return] ${title}
##### UserKeywords.robot ####
*** Settings ***
Library SeleniumLibrary
Resource ../Resources/Resources.robot
*** Variables ***
${url} http://www.newtours.demoaut.com/
${browser} chrome
*** Test Cases ***
TC1
${pageTitle}= launchAppication ${url} ${browser} # User defined Keyword with Aurguments
log to console ${pageTitle}
log ${pageTitle}
input text name:userName mercury
input text name:password mercury
*** Settings ***
Suite Setup log to console Opening Browser
Suite Teardown log to console Closing Broser
Test Setup log to console Login to application
Test Teardown log to console Logout from application
*** Test Cases ***
TC1 Prepaid Recharge
log to console This is prepaid recharge testcase
TC2 Postpaid Recharge
log to console This is postpaid recharge testcase
TC3 Search
log to console This is Search test case
TC4 Advanced Seearch
log to console This is Adv Search Test case
*** Settings ***
*** Test Cases ***
TC1 User RegistrationTest
[Tags] regression
log to console This is user reg test
log to console user registration test is over
TC2 LoginTest
[Tags] sanity
log to console This is login test
log to console Login test is over
TC3 Change user settings
[Tags] regression
log to console This is changin user settings test
log to console Change user setting s test is over
TC4 Logout Test
[Tags] sanity
log to console This is logout test
log to console logout test is over
Course Introduction:
Welcome to the Robot Framework Test Automation Course! This comprehensive program is designed to equip you with the essential skills to master acceptance testing and acceptance test-driven development (ATDD) using the powerful and versatile Robot Framework. Whether you're a beginner or have some experience in test automation, this course will guide you through the intricacies of Robot Framework, known for its user-friendly tabular test data syntax and keyword-driven testing approach.
Course Overview:
Introduction:
Understand the fundamentals of Robot Framework, its purpose, and its role in acceptance testing and ATDD.
Basic Test Case:
Learn how to create and execute basic test cases, exploring the foundation of Robot Framework's testing capabilities.
Handling Web Elements:
Dive into the specifics of interacting with various web elements such as input boxes, radio buttons, checkboxes, and drop-downs.
Waits:
Explore the concept of waiting in test automation, ensuring synchronization with the application under test.
Close Browsers, Alerts & Frames:
Learn how to efficiently handle browsers, alerts, and frames during test execution.
Handling Browser Windows:
Understand methods for dealing with multiple browser windows effectively.
Links & Navigations:
Explore navigation techniques and strategies for handling links within your test automation scripts.
Capture Screenshots:
Master the art of capturing screenshots to enhance debugging and reporting.
Mouse Actions:
Understand and implement mouse actions for more dynamic interaction with web elements.
User Defined Keywords:
Create and utilize custom keywords, extending the capabilities of Robot Framework.
Scrolling Page:
Learn how to scroll through web pages, an essential skill for testing content-rich applications.
For Loop:
Implement loop structures to optimize and iterate through test scenarios efficiently.
Table:
Handle tables within web applications, a common feature that poses unique challenges in automation.
Data-Driven Testing:
Explore various approaches to data-driven testing, including script-based and integration with external data sources like Excel, CSV, and databases.
Setup-Tear down:
Understand the importance of setup and tear-down procedures for maintaining test environment consistency.
Tagging:
Utilize tagging to categorize and organize test cases, making test suite management more efficient.
Page Object Model:
Implement the Page Object Model (POM) to enhance test script maintainability and reusability.
Parallel Execution:
Optimize test execution time by running tests in parallel, a crucial aspect for large test suites.
Headless Browser Testing:
Explore headless browser testing, a technique for executing tests without a visible browser interface.
Jenkins Integration:
Integrate Robot Framework with Jenkins for seamless automation in a continuous integration environment.
Stay tuned for more exciting content updates as we delve deeper into advanced topics. Let's embark on this journey together to become proficient in Robot Framework test automation!