How to verify single checkbox in a webpage using selenium?

TestSteps

  • Open the Firefox browser
  • Navigate the AppUrl
  • Identify Checkbox1
  • Select Checkbox1
  • Verify Checkbox1
  • Close the current Browser window

Selenium Code :

——————–

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class VerifyCheckbox {

public static void main(String[] args) {

  //open the firefox browser

WebDriver Driver = new FirefoxDriver();

  //navigate the AppUrl

Driver.get(“http://demo.guru99.com/test/radio.html”);

// Identify Checkbox1

WebElement CheckBox1= Driver.findElement(By.id(“vfb-6-0”));

//Select Checkbox1

CheckBox1.click();

   //Verify Checkbox1

if (CheckBox1.isSelected())

{

System.out.println(“Checkbox1 Selected”);

} else

{

System.out.println(“Checkbox1 not Selected”);

}

  //Close the current Browser window

Driver.close();

}

}

How to verify multiple checkboxes in a webpage using sselenium?

TestSteps :

  • Open the firefox browser
  • Navigate the AppUrl
  • Identify all Checkboxes and store into checkBoxes variable
  • Print the total checkboxes
  • Select multiple checkboxes one by one
  • Verify multiple checkboxes one by one
  • Close the current Browser window

 Selenium Code :

——————–

package seleniumProject;

import java.util.List;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Verify_Multiple_Checkboxes {

public static void main(String[] args) {

       //open the firefox browser

WebDriver driver = new FirefoxDriver();

  //navigate the AppUrl

driver.get(“http://demo.guru99.com/test/radio.html”)

     // Identify all Checkboxes and store into checkBoxes variable

List<WebElement> checkBoxes = driver.findElements(By.xpath(“//input[@type=’checkbox’]”));

   //print the total checkboxes

System.out.println(checkBoxes.size());

for(int i=0; i<checkBoxes.size(); i++)

{

  //select multiple checkboxes one by one

checkBoxes.get(i).click();

       //verify multiple checkboxes one by one

if(checkBoxes.get(i).isSelected())

{

System.out.println(i+” checkBox is selected “);

}else{

System.out.println(i+” checkBox is not selected “);

}

}

  //Close the current Browser window  

driver.close();

}

}

SELENIUM | BROWSER COMMANDS :

isSelected(): By using this we can verify particular checkbox is selected or not on a webpage.

 

Click here: Steps to configure Selenium WebDriver with java to develop test scripts

Click here: How to handle frame in selenium webdriver using java?

Selenium Training in Hyderabad

Kosmik Technologies is on of the best selenium training in Hyderabad. We are providing lab facilities with complete real-time training. Training is based on complete advance concepts. So that you can get easily “hands-on experience”. We will give 100% job assistance.

 

Manual testing interview questions
Manual testing interview questions
1) Difference between Regression and retesting?
 
Retesting:
 
When QA identified a defect, then it should be assign it to Developer. Once developer gives fix, then there should be retesting done to confirm defect has been removed or not. This we call RETESTING”. Retesting will done before regression.
 
Regression:
If any new code added to the application (New CR and Defected fixed code), ensure this new code doesn’t impact on other components of the system. Regression will done after retesting.
 
2) What are different phases in agile process?
 
Agile is very powerful SDLC methodology to implement software in a better manner.
 
  • Sprint planning.
  • Sprint meeting.
  • Sprint product demonstration.
  • Sprint Retrospective.
 3) Who Will prepare RTM(Requirement Traceability Matrix)
 
Requirement Traceability Matrix will ensure 100% test coverage. Which means every test case should be mapped to their corresponding Requirement. In an organization, QA Manager will prepare Requirement Traceability Matrix
  
4) Define Defect Life Cycle with defect status?
 
Defect life cycle starts with when defect found and when it successfully closed(also Known as Bug Life Cycle). In this defect undergoes different status, Which described below.
 
  • New: When QA member finds the defect.
  •  Open: Once QA lead/Manager review defect and change it status to open and assign it to Developer.
  •  Fixed/ Retest: Once defect got fixed from Developer and assign it to QA member.
  •  Re-OPenedIssue after retesting the defect. In this member assign defect to Developer again.
  •  Rejected: There will be two reasons to reject defect from Developer.
  •  Duplicate Defect: Same defect has been raised by another QA member
  •  Not a Defect: Raised defect is not related to Requirement.
  •  Deferred: Fix will be given in further phases.
  •  Closed: Once the retested defect meets user requirement, QA member will close the defect.
 5) Where Test cases will be written in QC?
 
Test cases design will be done in Test Plan.
 
6) Where Test cases will be executed?
 
When tested application is migrated to QA Environment, then Test cases corresponding application will be pulled to Test lab and will be executed.
 
7. Name different requirement documents?
 
  • SRS(System requirement specification)
  • BRD (Business requirement document)
  • TRD (Technical Review document)
  • User Manuals.
  • Use cases
  • User stories(only in agile)
 8. What is meant by test scenario and test case?
 
Test scenario is “what to be tested and test case “How to be tested”. Test scenario is simply one liner statement Which explains about What to test. Whereas Test case gives detailed information about Pre-condition. What to test ,test description, design steps and expected results.
 
9. At What condition automation is preferred?
 
After completion of manual testing (application is in Stable), if any regression/repeated test cases going to execute, in that case Automation is preferred.
 
10) System and E2E testing levels will fall into what method?
 
System and E2E will come into Black Box Testing
 
11) What is meant by alpha and beta testing?
 
In Alpha, Application/Software is under Developer environment. Here we will shows case the application as per the user requirements.
 
Where in Beta, Application/Software is under user environment and Developer will send only few feedbacks to support UAT.
 
12) Name the roles and responsibilities of product owner in Agile?
 
Roles for product owner are:
 
He/She prioritize the Sprint duration.
 
He/She prioritize the User stories for the particular Sprint.
 
13) What things do we discuss in Retrospective meeting in Agile?
 
      Below things are discussed in Retrospective meetings.
 
  • Things went well.
  • Things not went well
  • Things need to be updated.
14) Name few SDLC types
 
SDLC types:
 
  • Water fall.
  • V-Model.
  •  Iterative.
  •  Spiral.
  •  Big bang.
  •  Agile etc.
15) Name types of integration testing?
 
  • Top- Bottom Approach.
  •  Bottom- Up Approach.
  •  Sandwich Approach.
  •  Big Bang Approach.