Selenium IDE:
Selenium IDE consists of 4 types of commands:
Locating web elements on any page with the help of Selenium IDE:
- Selenium IDE is very useful if you want to quickly create scripts to test your web application.
- It provides an easy interface for developing/Running/Debugging test scripts or test suites
- It is a Firefox add-on
- It provides Record & Playback functionality
- It can only run scripts on Firefox and it’s not available for other browsers
- You can export recorded tests in multiple languages to use with Selenium WebDriver
- Menu bar
- Tool bar
- Test case pane
- Log, reference, etc
Figure 1: Selenium IDE User Interface
|
Selenium IDE consists of 4 types of commands:
- type, click, sendkeys, select, check, typeAndWait, clickAndWait, selectAndWait
- assertTitle, assertText, assertElementPresent, assertAttribute
- verifyTitle, verifyText, verifyElementPresent, verifyAttribute
- waitForTitle, waitForText, waitForPageToLoad, waitForAttribute
Locating web elements on any page with the help of Selenium IDE:
- identifier
- Using id attribute
- Using name attribute
- xpath
- css
- link
- dom (Document Object Model)
- xpath=//tagName[@attribute='value']
- xpath=//*[@attribute='value']
- xpath=//tagName[@attribute1='value1' and @attribute2='value2']
- xpath=//tagName[@attribute1='value1' or @attribute2='value2']
- xpath=//tagName[text()='value1']
- xpath=//tagName[contains(@attribute, 'value1')]
- xpath=//tagName[starts-with(@attribute, 'value1')]
- xpath=//tagName[ends-with(@attribute, 'value1')]
- xpath=//tagName[@attribute='value']/childTag/GrandChildTag
- xpath=//tagName[index] index value is 1, 2, 3, 4, ...
- css=#idvalue
- css=.className
- css=tagName#idvalue
- css=tagName.className
- css=tagName[attribute='value']
- css=tagName[attribute1='value1'][attribute2='value2']
- css=tagName[attribute*='value1')] like contains
- css=tagName[attribute^='value1')] like starts-with
- css=tagName[attribute$='value1')] like ends-with
- css=tagName[attribute='value']/childTag/GrandChildTag
Google Search Test Case: | ||
open | /?gws_rd=ssl | |
type | id=lst-ib | selenium |
click | name=btnG | |
waitForTitle | selenium - Google Search | |
clickAndWait | link=Selenium - Web Browser Automation | |
assertTitle | Selenium - Web Browser Automation | |
verifyText | link=Download | Download |
SlideShareLogin | ||
open | http://www.slideshare.net/ | |
click | id=login | |
waitForValue | id=user_login | |
type | css=#user_login | username |
type | xpath=//input[@id='user_password'] | password |
clickAndWait | login_from_loginpage | |
waitForTitle | Share and Discover Knowledge on LinkedIn SlideShare | |
verifyTitle | Share and Discover Knowledge on LinkedIn SlideShare |
UploadFileSlideShare | ||
open | / | |
clickAndWait | link=Upload | |
type | name=file | C:\Users\sysadm\Desktop\abc.docx |
waitForAttribute | id=img_slide_image@id | img_slide_image |
type | name=title | Simple File |
type | //textarea[@name='description'] | Sample Doc File |
select | name=top_cat | label=Education |
clickAndWait | xpath=(//button[@type='submit'])[2] | |
waitForTitle | Simple File | |
assertTitle | Simple File |
DeleteUploadedFile | ||
open | / | |
clickAndWait | link=Upload | |
clickAndWait | link=My Uploads | |
waitForElementPresent | //input[contains(@id,'heck-')] | |
check | //input[starts-with(@id,'check-')] | |
click | id=j-delete-common | |
waitForText | //div[@id='main-container']/div[2]/div/span | You do not have any uploads. |
verifyText | link=Upload one now | Upload one now |
SideshareLogout | ||
open | / | |
clickAndWait | link=Upload | |
clickAndWait | link=Logout | |
verifyTitle | Share and Discover Knowledge on LinkedIn SlideShare | |
verifyText | id=login | Login |
Thank you for sharing wonderful information with us to get some idea about that content.
ReplyDeleteSelenium Online Courses
Selenium Online Training Hyderabad