0% found this document useful (0 votes)
22 views

Lab 2

Uploaded by

zannatulmaoameem
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Lab 2

Uploaded by

zannatulmaoameem
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

BANGLADESH UNIVERSITY OF PROFESSIONALS (BUP)

Department of Information and Communication Technology


ICT 4102 : Software Testing and Maintainance Lab
Lab No - 02

Title: Install Selenium IDE and Record Test Scenarios


Introduction to Selenium IDE
Selenium IDE is an open-source tool that is widely used in conducting automated web testing and browser
automation. This tool is intended mainly for Web Application testers and developers to develop, edit, and run
automated test cases for Web Applications. Selenium IDE lets you easily playback and record interactively web
application activities during test automation on the browser-based interface. You don’t need much programming
skills to use it. Even if you’re not great at programming, you can still make simple automated tests with it.

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.

Features of Selenium IDE


1. Language Support: Selenium supports multiple programming languages like Java, Python, C#, Ruby, Perl,
etc., for writing test scripts thus making testers write their own set of automation test scripts in their preferred
language.
2. Multi-Browser Compatibility: Selenium supports multiple web browsers such as Chrome, Firefox, Safari,
and Internet Explorer, allowing cross-browser testing.

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.

Figure 1: Home page

• Go to the Chrome Web Store ( https://chromewebstore.google.com/detail/selenium-


ide/mooikfkahbdckldjjndioackbalphokd?hl=en ) or
Firefox Add-ons Store ( https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/ ) .
• Search for "Selenium IDE" and click on the "Add to [Browser]" button.

• Confirm the installation and wait for the extension to be added.


2. Launch Selenium IDE:
• Open the Selenium IDE extension by clicking its icon in the browser's toolbar.
• If you don't see the icon, check your browser's extension settings to ensure it is enabled.
3. Create a New Project:
• Upon launching Selenium IDE, a welcome dialog will appear.

2|Page
• Click on "Create a new project" and provide a name for your project.

• Add a new test case by clicking ‘+’ on the Tests tab.

• 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/

4. Record Test Scenarios:


• Click on the "Record" button (usually a red button) in the Selenium IDE interface.

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.

Basic Selenium Command

Selenium commands are broadly classified into:


1. Actions - Commands that interact directly with the application:
clickAndWait(),
typeAndWait()
2. Enable the user to store certain values to a user-defined variable:
storeTitle()
3. Assertions - Verifies the current state of the application along with an expected state. There are different
types of assertions:
1. Assert command makes sure that the test execution is terminated in case of failure
2. Verify command ensures script execution even if the verification has failed
3. WaitFor command waits for a specific condition to be met before executing the next test step

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

You might also like