Complete Guide to Selenium Automation Tool

Complete Guide to Selenium Automation Tool

By - Laxmi Kamble5/15/2025

Testing a web-based application or its features with the help of an automation tool like Selenium, also designing and executing test scripts in a text editor such as Eclipse ,is called Automation Testing. Master web testing with the Complete Guide to Selenium Automation Tool. Learn its features, frameworks, and best practices for robust and efficient test automation.

 

 

Disadvantages of Manual Testing

1] Compatibility Testing is difficult

2] The test cycle duration will be increased

3] More efforts are required

4] Regression testing is time-consuming

 

Advantages of Automation Testing

1] Reusability of Test Scripts

2] Compatibility testing is possible and easy

3] fewer human efforts are required

4] The project duration will be reduced

5] To overcome the drawbacks of regression testing, automation is useful

6] The cost of the project will be reduced

7] It is reliable and efficient

 

Some of the tools of Automation Testing

1] Selenium

2] QTP

3] Appium

 

 

 

 

Advantages of Selenium

1] open source

2] multi-language supportable

3] Cross-browser testing is possible in an easy way

 

Disadvantages of Selenium

1] It can't automate desktop-based applications

2] It can't automate CAPTCHA

3] It can't automate OTP

4] It can't automate barcode and QR code

5] It can't uploada  file

 

JAVA concepts used in Automation

1] Inheritance

2] Interface

3] polymorphism

4] casting

5] encapsulation

6] abstraction

7] Arrays

8] collections

9]Looping statements, conditional statements control statements

10]String class

 

 

 

Selenium Architecture:

 Complete Guide to Selenium Automation Tool

                                                                                                                                                                                                                                                                                 

-In the above architecture search context is a supermost interface that contains aan bstract method and is inherited to webdriver

-WebDriver is an interface that contains abstract methods of Search Context interface and its own abstract method

-All the abstract method are override or implemented in selenium remote webdriver class

Selenium Remote WebDriver: It is a class which implements all abstract method of both the interface

-selenium remote webdriver class extends to browser such as IE,Mozillla,chrome,Microsoft Edge etc

-create an object of chromedriver class with references of webdriver interface

Syntax:

Object-//WebDriver driver=new ChromeDriver(); -chromeBrowser

-//WebDriver driver=new EdgeDriver();   -MicrosoftEdge

// WebDriver driver=new FirefoxDriver(); -Mozilla

 

-webdriver is an interface used to perform action on web browser

driver.get(“https://www.google.com”);-To launch an appln

driver.manage().window().maximize();-to maximize appln

Thread.sleep(3000);  -to match test script speed with browser speed

 

Step by step, learn Selenium:  

Selenium WebDriver is an API and protocol that defines a language-neutral interface for controlling the behaviour of web browsers. Each browser is backed by a specific WebDriver implementation, called a driver. The driver is the component responsible for delegating down to the browser, and handles communication to and from Selenium and the browser.

This separation is part of a conscious effort to have browser vendors take responsibility for the implementation for their browsers. Selenium makes use of these third party drivers where possible, but also provides its own drivers maintained by the project for the cases when this is not a reality.

The Selenium framework ties all of these pieces together through a user-facing interface that enables the different browser backends to be used transparently, enabling cross-browser and cross-platform automation.

Selenium setup is quite different from the setup of other commercial tools. Before you can start writing Selenium code, you have to install the language bindings libraries for your language of choice, the browser you want to use, and the driver for that browser.

Steps to download Selenium

1] go on the website selenium.dev

2] go on java version (coffe cup)

3] click on 4.29.0 [Latest stable version]

4] it will show you zip file into downloads

5] unzip that file by right clicking on it Extract here or Extract to selenium

6] It will show you an unzip selenium.java folder in that all jar files of selenium downloaded

7] Go on eclipse -file-new java project-Give name as Automation

8] Right click on Automation [project name] then go on Build Path

9] Go on configure build path-it will show you an window

10] on that window -go on libraries -classpath

11] click on classpath -Add External jars- downloads -select all jar files from selenium java unzip folder-open

12] it will add all jar files on that window -select all jar files again by selecting shift+downward arrow

13] click on Apply and close

Explore Other Demanding Courses

No courses available for the selected domain.

Design and Write your first Selenium script:

1.     Start a session by creating a random object of webbrowser

WebDriver driver=new ChromeDriver();

 

2. Take action on the browser

driver.get(“https://www.google.com”);-To launch an appln

 

3. Request browser information

Methods of WebDriver

1] get() -to launch webbrowser

2] navigate().to-to launch webbrowser

3] navigate().back-to perform backward operation

4]navigate().forward- to perform forward operation

5]navigate().refresh- to perform refresh operation

6]close()-to close current tab of browser

7]quite()-to close all tabs and  browser

8]setSize()-to change the size of browser

9]setPosition()-to change the position of browser

 

4. Establish waiting time to match test script speed with browser speed

Waits in Selenium:

-The Automation test script speed is very high compared to web application speed ,to make proper automation script the speed of web application and automation test script should perfectly match this process is called Synchronization

Unconditional Synchronization :

-Here ,we will make the tool to wait until certain amount of time

 -Thread.sleep()

-here, we have to make application to wait for certain amount of time by passing timeout value

-it is a static wait

-it is provided by java ,it will stop the execution of test script for the required period of time

 

5. Find an element

*Methods or Functions of Web-Element

 to send the data in web-element or text boxes

-1] user.sendKeys(“Seven”)

User- reference   firstname.sendKeys("LK");

-This data send to user text box

 

Syntax:

WebElement emailorphone=driver.findElement(address of webelement);

emailorphone.sendKeys(“lk@gmail.com”);

 

6. Request element information

-getText() : getText() method is used to get the text present on the Web-Element

-return type String

Ex:   

WebElement loginbutton =driver.findElement(By.xpath());

String text=loginbutton.getText();

 

8. End the session

driver.close()- to close current tab

driver.quit()- to close current tab and browser also

Web-browser Launching code :

 

System.setProperty(“ webdriver.chrome.driver”,”path of .exe chromedriver “);

 

WebDriver driver= new Chromedriver();  //import from selenium

 

driver.get(“https://www.fb.com”);

 

driver.manage.window().maximize();

 

Thread.sleep(3000);    //one kind of static wait and used to match the speed of test script/selenium tool with browser speed and it applies on whole webpage

 

driver.navigate().to(“https://www.fb.com”);

 

driver.navigate().back()   //forward    //refresh

 

driver.close() – closes current tab

driver.quit()  -close multiple tabs / browser

 

String url=driver.getCurrenturl();

Syso(url);

String title=driver.getTitle();

Sop(title);

 

//import from selenium

Dimension d =new Dimension(300,400);   (width,height)

driver.manage().window().setSize(d)

 

Point p= new Point(500,300)   //import from selenium

driver.manage().window().setPosition(p)

 

 Do visit our channel to learn more: SevenMentor 

Author:-

Laxmi Kamble

Get Free Consultation

Loading...

Call the Trainer and Book your free demo Class..... Call now!!!

| SevenMentor Pvt Ltd.

© Copyright 2025 | SevenMentor Pvt Ltd.

Share on FacebookShare on TwitterVisit InstagramShare on LinkedIn