Lab 2
Lab 2
Selenium Overview
IDE
IDE (Integrated Development Environment) is the tool you use to develop your Selenium test cases. It’s an easy-
to-use Chrome and Firefox extension and is generally the most efficient way to develop test cases. It records the
users’ actions in the browser for you, using existing Selenium commands, with parameters defined by the context
of that element. This is not only a time-saver but also an excellent way of learning Selenium script syntax.
WebDriver
If you are beginning with desktop website or mobile website test automation, then you are going to be using
WebDriver APIs. WebDriver uses browser automation APIs provided by browser vendors to control the browser
and run tests. This is as if a real user is operating the browser. Since WebDriver does not require its API to be
compiled with application code, it is not intrusive. Hence, you are testing the same application which you push
live.
Grid
Selenium Grid allows you to run test cases in different machines across different platforms. The control of
triggering the test cases is on the local end, and when the test cases are triggered, they are automatically executed
by the remote end.
After the development of the WebDriver tests, you may face the need to run your tests on multiple browsers and
operating system combinations. This is where Grid comes into the picture.
1|Page
3. Flexible language: Once the test cases are prepared, they can be executed on any operating system like
Linux, Macintosh, MAC, etc.
Objective:
Learn how to install Selenium IDE and record test scenarios using the record and playback feature.
Materials Needed:
• A computer with internet access
• A web browser (Chrome or Firefox)
• Selenium IDE extension
Steps:
1. Install Selenium IDE:
• Open your web browser (Chrome or Firefox) and visit Selenium’s website or use this link to add
the extension.
2|Page
• Click on "Create a new project" and provide a name for your project.
• Enter the base URL (e.g. https://www.google.com )of the application you will be testing. More
url : https://the-internet.herokuapp.com/ , https://katalon-demo-cura.herokuapp.com/ ,
https://thetestingworld.com/testings/
3|Page
• The browser will open the base URL you provided.
• Interact with the web application as you normally would.
• Each action you perform will be recorded by Selenium IDE.
• To stop recording, click the "Stop" button in the Selenium IDE interface.
5. Review and Edit Recorded Test:
• After recording, you can review the recorded test steps in the Selenium IDE.
• You can edit the test steps if needed by clicking on individual commands and modifying them.
6. Save and Run Test:
• Save your test by giving it a name.
• Run the test by clicking the "Play" button to see if it works as expected.
7. Organize Tests:
• You can organize your tests into test suites for better management.
• Create a new test suite by clicking the "+" button next to "Test Suites" and provide a name.
• Add tests to the suite by dragging and dropping them into the suite.
4|Page
Element Locator
We need to install some add-ons for collecting these element location . You can download -
https://chromewebstore.google.com/detail/css-and-xpath-checker/aoinfihhckpkkcpholfhmkeplbhddipe?hl=en ,
https://chromewebstore.google.com/detail/pom-builder-%E2%80%93-auto-
genera/akcejfbfkkjnghlfngighgncolfaghco?hl=en
1. Id > id = userName
2. Name > name = pass
3. Link Text > link= text present in a tag
4. Class Name > here class name can locate many element that’s why we need unique element locator .
5. CSS > css=label[for=”tab2”]
Syntax 01 :
Css using id : css=#id
CSS using id and tag: css=input#id
Syntax 2:
CSS using class: css=.ClassName
CSS using class and tag: css=input.id
Syntax 03:
Using any attribute value : css=[type=’email’]
Css= input[id=’email’]
Syntax 04:
Using id and attribute value : css=#pass[type=’password’]
Using tag with id and attribute value : css=input#pass[type=’password’]
Syntax 05:
Using class and attribute value : css=.inputText[type=’email’]
Using tag with class and attribute value : css=input.inputText [type=’email’]
6. Xpath
//input[@name=’fld_usernmame’]
Xpath using multiple attribute OR condition
//input[@name=’fld_usernmame’ or @aria-label=’First name’]
Locating element through child
//input[@type=’email’]/parent::td/parent::tr/parent::tbody/parent::table
Conclusion:
You have successfully installed Selenium IDE and recorded test scenarios using the record and playback feature
. You can now use these recorded tests to automate your web application testing.
5|Page