Selenium IDE - Sample Script With Most Commonly Used Commands

In this post, you will learn to automate most common actions that a QA perform quite often while web testing. General actions are: type, click on links, select dropdown option, multi-select, checking radio buttons and check boxes, uploading files and clicking on buttons, moving backward and scrolling. Above mentioned actions cover 90% of our testing. And it's fortunate to have Selenium IDE supports all these actions.


List of most commonly used commands of Selenium IDE:


CommandsDescription
openTo open URL
setTimeoutSetting Timeout Limit
windowMaximizeFor Window Maximizing
storeStoring value in variable
echoTo print/log custom messages in console
clickAndWaitClicking on link
goBackAndWaitTo navigate backwards
typeTo enter values in a text field
storeEvalExecuting Javascript / Scroll
clickChecking Radio Button / Check box
selectTo Select dropdown option
addSelectionFor multiple selection boxes
assertTitleTo verify title




Sample Script to automate "About Me" Web Form:

Practice Form
CommandTargetValue
open/automation-practice-form/
setTimeout10000
windowMaximize
storeSelenium Tutorials | Demo Form for practicing Selenium AutomationEXPECTED_PAGE_TITLE
echo"####### Clicking Link ########"
clickAndWaitlink=Link Test
echo"###### Using goBack command to navigate to previous page ######"
goBackAndWait
echo"###### Typing First Name and Last Name ######"
typename=firstnameDustin
typename=lastnameTaylor
echo####### Performing Scroll Action #########
storeEvalselenium.browserbot.getCurrentWindow().scrollTo(0,600)
echo"###### Check Radio Buttons & Check boxes #######"
clickid=sex-1
clickid=exp-3
clickid=profession-1
clickid=tool-1
echo"####### Performing File Upload Action #######
typeid=photoC:\Users\admin\Desktop\pic.jpg
echo####### Performing Scroll Action #########
storeEvalselenium.browserbot.getCurrentWindow().scrollTo(0,1000)
echo"####### Performing Select & Multi-Select Actions ########"
selectid=continentslabel=Australia
addSelectionid=selenium_commandslabel=Navigation Commands
addSelectionid=selenium_commandslabel=Switch Commands
clickAndWaitid=submit
echo${EXPECTED_PAGE_TITLE}
assertTitle${EXPECTED_PAGE_TITLE}
echo"###### PASSED - Test Completed Successfully #######"



Overview & Features  << Previous      ||      Next >>  Diff. b/w Selenium IDE & Webdriver





Refer Selenium Webdriver Tutorials Series

Author: Vaneesh Behl

Subscribe FB Group Techlistic on FB
Join Telegram channel at https://t.me/techlistic
Feel free to ask queries or share your thoughts in comments or email me.


Follow Us

Quora Space | Facebook Page | Telegram Channel
Feel free to ask queries or share your thoughts in comments or email us.

Comments

Popular posts from this blog

10 Best Demo Websites for Automation Testing Practice

Automate 'User Registration' of E-commerce Website using Selenium

Automate Browser Actions on Godaddy.com using Selenium

Selenium WebDriver Browser and Navigation Commands