Overview Of Automation Testing

  • By Laxmi Kamble
  • March 28, 2025
  • Software Testing
Overview Of Automation Testing

Overview Of Automation Testing

-Testing an application features with the help of an automation tool and executing test scripts is called Automation Testing. Get an Overview of Automation Testing, its benefits, tools, and best practices to enhance software quality, speed, and efficiency in the development process.

 

Disadvantages of Manual Testing

1] Compatibility Testing is difficult

2] 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] less human efforts are required

4] 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 cants automate desktop-based application

2] It cants automate the captcha

3] It cant automate OTP

4] It cant automate barcode and QR code

5] It cant upload 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

 

Objects to be created to call methods in selenium

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

WebDriver driver=new EdgeDriver();   -MicrosoftEdge

 WebDriver driver=new GeckoDriver();    -Mozilla

 

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

 

Selenium Architecture:

 

                                                            

Q. 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

 

Q. window interface methods

10]maximize()-to maximize the application/browser

11]minimize()-to minimize the application/browser

 

Q. Methods of Search Context Interface

1] findElement -used to locate or identify the address of a single web element

2] findElements-used to locate or identify the address of a list of elements

 

Syntax : 

-to send value to the empty text box on webpage,w e are using sendKeys() method

 

WebElement username=driver.findElement(“address if webelement”);

username.sendKeys(“LK”);  //to pass value into the text box

 

-to click on any kind of button for we are using click() method

How to find webElement present on a webpage

driver.findElement()-to locate or identify webelement

By-class-accept that argument

Syntax: 

WebElement   nameOfWebElement = driver.findElement(By.locator(“ ”));

 

Types of Locators-

1] id                                            -Attributes

2] name                                     -Attribute

3] classname                            -Attribute

4] tagname                 

5] linkText           –  text

6] partiallinktext           – text

7]X-path  -Expression

8]cssSelector- Expression

 

-After launching a website right click on any webelement , choose last option -inspect –ctrl+f –  By.id(“identifierId”)

Xpath:-above id path should be 1 on 1 matching ,copy that path and paste into below code

 

WebElement username = driver.findElement(By.locator(By.id(“ ”));   

username.sendKeys(“ ”);

General locators

WebElement firstname =driver.findElement(By.id(“firstname”));

firstname .sendKeys(“Ms”);

 

WebElement pwd=driver.findElement(By.name(“”));

pwd.sendKeys(“1234”);

 

WebElement login=driver.findElement(By.classname(“”));

login.click();

 

5]Linktext– if tagname is duplicate ,id, classname, attribute name are not present in html code structure of an element then we should use linkText or Partial linkText

CreateNewAccount – if you want to automate this link

WebElement link=driver.findElement(By.linktest(“CreateNewAccount”));

link.click();

 

6] PartiallinkText: used to identify element by taking few char of a text as an input

Forget

WebElement forget=driver.findElement(By.partiallinktest(“CreateNewAccount”);

forget.click();

 

Methods or Functions of Web-Element

 

Q. How 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”);

 

Q. How to click on Login or any button? 

Click()

-button.click();

-login.click();

 

Q. How to display that any web-Element is selected or not?

-isSelected() – this method is used to check whether the web-Element  (checkbox, radiobutton ,click box) is selected or not

-Return type is boolean

Ex: 

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

boolean  result= checkbox.isSelected();

if(result)

{

Sop(“It is selected by default);

}

else

{

Sop(“it is not selected”);

}

 

Q. How to verify that the web-Element is displayed or not

-isDisplayed() -It is used to verify whether the element is present (diplayed) on the screen or not 

-return type is Boolean

 

Ex:

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

boolean  result= element.isDisplayed();

if(result)

{

Sop(“It is present on the screen);

}

else

{

Sop(It is not present on the screen);

}

 

Q. How to identify a particular Web-Element is enabled or not?

-isEnabled() method is used to verify the web element is enabled or disabled 

-return type is Boolean

Ex:

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

 

Boolean result=loginbutton.isEnabled();

if(result)

{

Sop(“element is enabled”);

}

else

{

Sop(“element is disabled”);

}

 

Q. How to get the text that is present on webelement or check whether the text present on the webelement is correct or not

 

-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();

If(text.equals(“expected text”))

{

Sop(“Text is verified”);

}

else

{

Sop(“Text is wrong”);

}

Ex:Firstname : enter mobile or email id

(text compare with “expected text”)

 

Q. How to get the Attribute value of webelement

-get.Attribute() -this method accept the string-type argument where we need to pass the attribute name and after execution, this method returns the value as a string 

Ex:

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

String text=loginbutton.getAttribute(“Attribute name”);

 

If(Attributevalue.equals(“expected value/text”))

{

Sop(“Attribute is verified”);

}

else

{

Sop(“Attribute is wrong”);

}

 

HTML structure to identify the address of webelement and use it in findElement() method:

<!DOCTYPE html>

<html>    //opening tag

<hed>

<title> Pune </title>

</head>

<body style=”background-color:Darksea Green “align=”middle”>

<h1>students informative page</h1>  -subheading

<p>Add students login details</p>  -paragraph

<div>

<input> id=”email” </input> [<tagname attriutename=”attribute value”]

<br>

<br>

</div>

<div>

<input> id =”pass”  </input>[<tagname attriutename=”attribute value”]

</div>

<div>

<button> name=’submit’ </input>[<tagname attriutename=”attribute value”]

</div>

</body>

</html>         //closing tag

 

1] tagname :

Anything present after (<) symbol is tagname

Ex: <input or<button

2] Attribute :

Anything present after tagname is attribute or attribute name

-id ,name ,type,value,class

3] Attribute value:

-Anything present after attribute = is attribute value

Ex: =”email”,=”pass”,=”submit”

4] HTML text : 

Anything present in between >—–text—<

Ex: > create account<

Ex:

<DOCTYPE!>

<html>

<head>

<title> Maharashtra Info Page</title>

</head>

<body style=”background-color:darkseagreen;”>

<h1 style=”color:blue;font-size:50px”>States</h1>

<p style=”color:red;font-size:25px”> Cities in the state</p>

<div>

<input> id=”email”</input>

</div>

<br>

<br>

<div>

<input> id=”password”</input>

</div>

<br>

<br>

<div>

<button> name=”submit”</button>

</div>

</body>

</html>

 

Do visit our channel to learn more: Click Here 

Author:-

Laxmi Kamble

Call the Trainer and Book your free demo Class For Software Testing Call now!!!

 | SevenMentor Pvt Ltd.

© Copyright 2021 | SevenMentor Pvt Ltd.