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.

What is testing tools?

Before knowing Software testing, we need to know what is meant by the word “TEST”.

In real world, we see TEST as

  • Test exam: Conducting an exam to check the students percentage of pass/fail.

Action items: As per the questions given, students answer to the corresponding questions (which means every question should have expected answers.)

  • Test Lab Reports: Here as per the sample given, will go a process of treatment as per the reports.

Action Items: As per the reports will contact doctor and do the corrective actions.

  • Test Drive: Here will check performance (speed, mileage, engine pickup, etc…,) of the driven vehicle.

Action Items: Here we will check whether the vehicle is as per our requirements or not.

  • Test Match: Everyone knows what is meant by Test Cricket, where we mainly focuses on player performance like stamina, sustain, resistance, patience etc…,

Action Items: Player will be IN the team if his/her performance is good.

Now derive, definition of Software Testing from real-time examples:

Software testing is a process of identifying the issues and do the corrective actions and provide quality product of an application/product/software.

Aim: Is to focus on user requirements, needs and expectations of the user/customer.

Job: To find the failures in the application and do the corrective actions as per user needs.

Testing Tools Training in Hyderabad

Testing Tools:

For doing testing in this advanced world, we will use some testing tools in order to fasten the work, bring system into stable, check in multiple applications simultaneously, provide continues reports to user for easy to understand, etc…,

Some of the well-known testing in market are:

  1. TestComplete
  2. Selenium
  3. LeanFT
  4. Tosca
  5. UFT
  6. Rational Functional Tester

 

testing tools in market

 

Automation tools:

Nowadays, development pactices changes frequently and many updates are proposed which aims to provide quality, customer expectations, productivity etc…, and the same should be happen when comes to test automation.

The main Automation tools available in current market are:

  1. UFT
  2. Selenium
  3. Katalon Studio
  4. TestComplete
  5. Rational Software etc…,

 

Automation Testing

Automation Tools

What is meant by Manual Testing?

Basically Software Testing is divided into two types:

  1. Manual Testing
  2. Automation Testing

Manual Testing vs Automation Testing

Manual Testing will be defined as:

Software testing where QA team manually executes written Test cases without any automation involved will be considered it as Manual Testing.

Aim of Manual Testing to find/identify the bugs/defects in the application/product/software using written Test cases and focus on delivery quality application / product / software which meets ccustomer/userneeds.

Manual Testing

indepths of Manual Testing

Why Manual Testing needed?

  • Whatever we expect should come:

Example: When we try to launch https://www.gmail.com login page, it should show me the same, but if it opens https://www.yahoomail.com which is not as expected. Hence there should be a team (QA) to check whatever user needs should come.

Why manual Testing

  • Application behavior varies from one to many users, so it should work as expected when deals with one to many:

Example: Generally we have noticed server slow / down when we try to book railway tickets at Tatkal timings and as well as when server publish exam result. This is mainly due to load on the server. So there should be a team (QA) to check the server performance with one to many user.

  • Application in different places should work without any dependency:

 

Example: # Many people uses different devices like IPhone, Moto, Samsung, MI etc…,

    # Not only this, people uses many browsers like Mozilla, Chrome, IE, Safari etc…,

    #adding to this, many people uses many Operating Systems like Windows, Linux, MAC, Android, IOS etc…,

Hence application should behave same irrespective of devices / Browsers / Operating Systems which means a team (QA) should require to support this checks.

Manual Vs Automation:

As the name Manual suggests, executing the application with respect to written Test Cases. And for Automation, will execute the application with respect to written Test scripts. However we have many difference between Manual and Automation.

Manual

  • Investment required as human are involved.
  • Time Consuming.
  • Less reliable, not accurate due to human errors.
  • Suitable at Exploratory Testing, Usability Testing and Ad-hoc testing.

Automation

  • Investment required on automation tools.
  • It will be faster than manual.
  • More reliable as Automation tools involve.
  • Suitable at regression testing, Load Testing, repeated testing and performance testing.

Manual Testing vs Automation testing

Software Testing Life cycle(STLC):

As a basic example, a human life will start as Infant, later goes through distinct ages to gradually grow and matured to grand age. Similarly, Software Testing Life Cycle has different phases to go though and gives us a Quality Product.

Phases:

  1. Test Requirement ANalysis.
  2. Test planning.
  3. Test case Design and Development.
  4. Test Environment Setup.
  5. Test Execution.
  6. Test Closure.
Software Development Life Cycle(SDLC):

Software Development Life Cycle involves entire product members to design, develop and gives the quality product as per the customer needs.

It is a conceptual and long-term view of software product to be delivered.

Types of SDLC models in real market:
  1. Waterfall Model.
  2. V-Model.
  3. Iterative Model.
  4. Spiral Model.
  5. Big-Band Model.
  6. AGILE Model etc…,

Manual testing interview questions and Answers

Testing Tools training in Hyderabad

Kosmik Provides Testing Tools training in Hyderabad(ClassRoom & Online). 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.

What is a frame?

Frame is just like as a container where few elements can be grouped.

How to identify frame inside a webpage?

There are different ways to identify frame inside a webpage

Way 1:

  • Open webpage in a browser.

webelement in a webpage

  • Right click on webelement in a webpage

frame inside a webpage

Way 2:

  • Open webpage in a browser.
  • Right click on webelement in a webpage
  • Open source code(Html Code) of the webpage by clicking inspect element with firebug option see below image.

iframe source code

How to handle an element inside the frame?

There are 4 ways to handles frames in selenium webdriver.

Switch to frame by using index :

Method 1 :

Suppose if there is single frame in a webpage then we can switch to the iframe by using index.

Here is the sample code:

Syntax : driver.switchTo().frame(int index);

Example : driver.switchTo().frame(0);

Note : By default single frame index value ‘ 0’.That means when webpage has  only one frame then the index will be zero.

Method 2 :

Suppose if there are 3 frames in a webpage then we can switch to the iframe by using index.

Here is the sample code:

Syntax :

List<WebElement> framelist=driver.findElements(By.tagName(“iframe”));

driver.switchTo().frame(framelist.get(int index));

Example :

List<WebElement> framelist=driver.findElements(By.tagName(“iframe”));

//switchTo 1st frame by using index

driver.switchTo().frame(framelist.get(0));

  //switchTo 2nd frame by using index

driver.switchTo().frame(framelist.get(1));

//switchTo 3rd frame by using index

driver.switchTo().frame(framelist.get(2));

Switch to frame by using Id or Name :

We can also use Name and Id attributes of iframe  through which we can switch to iframes.

Here is the sample code:

Syntax 1:

driver.switchTo().frame(“Id of  the element”);

Html code :

iframe html code

                                                                                  Example : driver.switchTo().frame(“rightMenu”);

Syntax 2:

driver.switchTo().frame(“Name of  the element”);

Html code :

iframe html code

                                                                              Example : driver.switchTo().frame(“rightMenu”);

Switch to frame by using WebElement :

We can also switch to the frame using webelement.

Here is the sample code:

Syntax :

driver.switchTo().frame(WebElement);

Html code :

iframe html code

Example : driver.switchTo().frame(driver.findElement(By.name(“rightMenu”)));

How to get all the frames in a webpage ?

get all the frames in a webpage

Html code :

Open notepad and type the below Html code and save as frames.html

<html>

<body>

<iframe src=”http://www.seleniumhq.org/download/” width=”200″ height=”200″ name=”selenium”>

<p>Your browser does not support iframes.<p>

</iframe>

 

<iframe src=”http://127.0.0.1/orangehrm-2.5.0.2/login.php” width=”200″ height=”200″ name=”selenium”>

<p>Your browser does not support iframes.<p>

</iframe>

<br>

<iframe src=”http://testng.org/doc/index.html” width=”200″ height=”200″ name=”selenium”>

<p>Your browser does not support iframes.<p>

</iframe>

<br>

<a class=”gb_P” data-ved=”0EMIuCBMoAA” href=”https://mail.google.com/mail/?tab=wm” data-pid=”23″>Click on Gmail</a>

</body>

</html>

 

Example :

package seleniumProject;

import java.util.List;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

public class getTotalFrames {

public static void main(String[] args) {

//   Open Firefox Browser  

       WebDriver driver = new FirefoxDriver();

 //   Open AppURL In Browser

driver.get(“file:///C:/Users/Hanumanthu/Downloads/frames.html”);

 // count all the frames on a webpage

List<WebElement> total_frames=driver.findElements(By.tagName(“iframe”));

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

//close the current browser window

driver.close();

}

}

How to verify TestNg text inside 3rd frame?

verify TestNg text inside 3rd frame

Selenium Sample Code :

package seleniumProject;

import java.util.List;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

public class getTotalFrames {

public static void main(String[] args) {

   // Open Firefox Browser  

WebDriver driver = new FirefoxDriver();

//  Open AppURL In Browser

driver.get(“file:///C:/Users/Hanumanthu/Downloads/frames.html”);

 //count all the frames on a webpage

List<WebElement> total_frames=driver.findElements(By.tagName(“iframe”));

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

 //Switch to 3rd Frame by using Index

driver.switchTo().frame(total_frames.get(2));

  //Identify and get the text and store into testNg_text variable

String testNg_text=driver.findElement(By.xpath(“html/body/h2[1]”)).getText();

   //print the text from 3rd frame

System.out.println(testNg_text);

  //verify the text from 3rd frame

if(testNg_text.equals(“TestNG”))

{

System.out.println(“TestNG text verified successfully”);

}else

{

System.out.println(“TestNG text not verified successfully”);

}

 //How switch back to main window from inside any frame ?

driver.switchTo().defaultContent();

//Close the Firefox Browser

driver.close();

}

}

Note :

switch back to main window from inside any frame

1. Switch to 3rd Frame by using Index

Syntax :   driver.switchTo().frame(total_frames.get(index));

Example :   driver.switchTo().frame(total_frames.get(2));

2.Switch to 3rd  Frame by using Id

Syntax :   driver.switchTo().frame(“Id of the element”);

Example :   driver.switchTo().frame(“selenium”);

If no id then go for Name.

 3.Switch to 3rd  Frame by using Name

Syntax :   driver.switchTo().frame(“Name of the element”);

Example :   driver.switchTo().frame(“selenium”);

4.Switch to 3rd  Frame by using WebElement

Syntax :   driver.switchTo().frame(WebElement);

Example :   driver.switchTo().frame(driver.findElement(By.name(“selenium”);

 How switch back to main window from inside any frame ?

Syntax : driver.switchTo().defaultContent();

 How to handle frame in selenium webdriver using java

TestSteps:

Open Firefox Browser

Open AppURL In Browser

Get the Title of WebPage

Verify Title of WebPage

Enter the username

Enter the password

Clicking On Login Button

Identify and get  the Welcome selenium text

Verify  Welcome selenium text

Switch to frame

Handle DropDown in Selenium

  1.  How to print all the dropdown values
  2. How to Select the dropdown value inside a frame
  3. verify selected value from dropdown
  4. How to Verify dropdown values

Again switch back to main window from frame

Clicking On Logout Button

Close the Firefox Browser

Selenium Code :

package com.tests;

import java.util.List;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

importorg.openqa.selenium.support.ui.Select;

public class OrangeHRM_login {

public static void main(String[] args) throws Interrupted Exception {

// open the firefox browser

WebDriver driver = newFirefoxDriver();

// navigate the AppUrl

diver.get(“http://127.0.0.1/orangehrm-2.5.0.2/login.php”);

//Get the Title of WebPage

String title=driver.getTitle();

//print the title of the webpage

System.out.println(title);

//Verify Title of the WebPage

if (title.equals(“OrangeHRM – New Level of HR Management”)) {

System.out.println(“title is verified successfully”);

} else {

System.out.println(“title is not verified successfully”);

}

// Enter the username

  driver.findElement(By.name(“txtUserName”)).sendKeys(“selenium”);

// Enter the password

driver.findElement(By.name(“txtPassword”)).sendKeys(“selenium”);

// Clicking On Login Button

driver.findElement(By.name(“Submit”)).click();

// Identify and get  the Welcome selenium text and store into text variable

String text = driver.findElement(By.xpath(“//*[@id=’option-menu’]/li[1]”)).getText();

// Print the welcome selenium text

System.out.println(text);

//  To verify whether the welcome page successfully opened or not

if (text.equals(“Welcome selenium”)) {

System.out.println(“Welcome selenium is verified successfully”);

} else {

System.out.println(“Welcome selenium is not verified successfully”);

}

// Switch to Frame by ID

driver.switchTo().frame(“rightMenu”);

System.out.println(“****How to print all the dropdown values inside a frame****”);

Identify the dropdown

// Identify the dropdown

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

// Identify  dropdown values  and store into droplist  variable

List<WebElement> droplist = dropdown.findElements(By.tagName(“option”));

// How to print all the dropdown values

for (inti = 0; i<droplist.size(); i++) {

System.out.println(droplist.get(i).getText());

}

System.out.println(“*****How to Select the dropdown value inside a frame*****”);

Select the dropdown value inside a frame

/*

                    If u want to select the dropdown value then we need to create the select object for that dropdown

                    */

Select s = new Select(dropdown);

// Select the dropdown value by using index

s.selectByIndex(2);

//s.selectByVisibleText(“Emp. First Name”);

//s.selectByValue(“1”);

System.out.println(“****verify selected value from dropdown inside a frame *****”);

verify selected value from dropdown inside a frame

//get the selected value and store into selected_value variable

String  selected_value=s.getFirstSelectedOption().getText();

//print selected value

System.out.println(“selected_value  :”+selected_value);

//verify selected value from dropdown

if (selected_value.equals(“Emp. First Name”)) {

System.out.println(“selected value  verified successfully”);

} else {

System.out.println(“selected value not verified successfully”);

}

// How switch back to main window from inside any frame

driver.switchTo().defaultContent();

// Clicking On Logout Button

driver.findElement(By.xpath(“//*[@id=’option-menu’]/li[3]/a”)).click();

// Close the Firefox Browser

driver.close();

}

}

Click here: How to verify multiple checkboxes in a webpage using selenium?

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

Selenium Training in Hyderabad

Kosmik Technologies is on of the best selenium training institutes 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.

Steps to configure Selenium WebDriver with java to develop test scripts

Pre-conditions: We need below files

Step 1: Download and Install JDK 8

Follow below URL

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Select Accept License Agreement radio button

Java SE Development Kit 8

Choose version to download: Windows 86 or x64 based on your OS (jdk-8-windows-i586.exe and jdk-8-windows-x64.exe)

  • wait until complete download.
  • copy downloaded file and paste in personal folder.
  • click on setup to start installation.
  • click on next until installation will go to end
  • click on close.
  • Restart Computer.

Note :

After completion of JDK installation tester can create environment variable for JAVA_HOME in your windows system by following below navigation.

  • Click on start
  • Right click on my computer
  • Click on properties
  • Click on Advanced system setting
  • Select Advanced tab
  • Click on Environment variable button
  • Go to user variables
  • click on New button
  • Type JAVA_HOME and provide path of JDK folder
  • click on ok

Follow below image

Environment variable button

  • Go to system variable
  • Select path
  • click on Edit button
  • Add path of JDK bin folder followed by semicolon(😉 at the end of existing path value
  • Click on ok
  • Click on ok

Follow below image

Environment variables

How to verify java successfully installed or not into your local system

  • Open the command prompt.
  • Run command “java -version”

 

It should show your installed java version detail as shown in above image. That means java is installed successfully into your local system and you are ready to use it.

Step 2: Download and launch Eclipse IDE

  1. IDE stands for Intigrated Development Environment. Eclipse Ide is useful to write our test scripts in java or java based tools like selenium.
  1. We need to follow below URL to download and launch Eclipse Ide

 

http://www.eclipse.org/downloads/packages/release/Mars/2

Eclipse Mars 2 Packages

 

Download the Eclipse Mars, you can choose version Windows 32 bit or 64 bit based on your OS

  • wait until complete download.
  • copy downloaded file and paste into personal folder and extract
  • click on Eclipse folder
  • Here click on ‘eclipse.exe’ file directly. Here no need to install eclipse into your local system.

Step 3: Download Selenium WebDriver Jar Files.

After completion of eclipse Ide launching with the creation of project, package, and class with main(), we need to download selenium webdriver jar file.

Follow the below steps :

  • Go to google search
  • Enter seleniumhq then search it
  • Click on first link(https://www.seleniumhq.org/download/)
  • Click on download
  • Scroll to Selenium Client & WebDriver Language Bindings
  • Click on download for java based selenium webdriver

Selenium Client & WebDriver Language Bindings

  • wait until complete download.
  • copy downloaded jar file and paste into personal folder and extract

Step 4: Associate selenium webdriver with eclipse Ide.

  • click on ‘eclipse.exe’ to start eclipse
  • First time when you start eclipse software application, it will ask you to select your workspace where your work will be stored as shown in bellow image.

Workspace Launcher

Choose a workspace folder name as D:\workspace and click on ok button .Here You can change the workspace location from ‘Switch Workspace’ under ‘file’ menu of eclipse.

Create new project

  • Go to File
  • New
  • Go to Java Project and give your project name ‘SeleniumProject’
  • Click on finish button.

Create new package

  • Right click on source folder(src)
  • New
  • Package
  • give the package name ‘SeleniumTests’
  • Click on finish button.

Create New Class

  • Right click on package ‘SeleniumTests’
  • New Class
  • give the class name ‘myTestLogin’
  • click on Finish button.

Add external jars for that project

  • Right click on project ‘SeleniumProject’
  • go to Java build path
  • configure build path
  • >select Libraries
  • Click on add external JARs button
  • Then go your jar file folder path location
  • select both .jar files from D:\selenium-java 3.12.0.
  • click on open button
  • Click on add external JARs button
  • Then go your jar file folder path location
  • select all .jar files from D:\selenium-java 3.11.0\libs
  • click on open button
  • click on ok button

Steps to Download and Install firebug Add-on.

Follow my below url to install Fire Bug

https://addons.mozilla.org/en-US/firefox/addon/firebug/

Click on Add to Firefox button

Click on Install button

After install FireBug then go to

Tools > Web Developer > Firebug > Open Firebug (or)you can use shortcut key ‘F12’

 

After open the firebug. Right-click on field or element in your application then click on inspect element with firebug option.

In html code take either id(or)name(or)className etc. from highlighted section.

See below image

Hospital Management System

Note: Here no need to restart your Firefox after installing Firebug Add-On

Steps to Download and Install firepath Add-on.

Follow my below url to install Firepath add-on

https://addons.mozilla.org/en-US/firefox/addon/firepath/

Click on Add to Firefox button

FirePath By pierre Tholence

Click on Install button

Click on Restart Now

After install firepath then go to

Tools > Web Developer > Firebug > Open Firebug (or)you can use shortcut key ‘F12’

You could find ‘FirePath’ as shown below image

 

Selenium WebDriver First Program :

TestSteps:

  • Open the firefox browser
  • Navigate the application url
  • Get the Title of the WebPage
  • Print the title of the webpage
  • Verify Title of the WebPage
  • Enter the username
  • Enter the password
  • Clicking On Login Button
  • Identify and get the Dashboard Text
  • Print the Dashboard Text
  • To verify whether the welcome page successfully opened or not
  • Clicking On Logout Button
  • Close the current Firefox Browser

Selenium Code :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class SampleClass {

public static void main(String[] args) throws Interrupted Exception {

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

//Get the Title of the WebPage

String title=driver.getTitle();

//print the title of the webpage

System.out.println(title);

//Verify Title of the WebPage

if (title.equals(“Administration”))

{

System.out.println(“title verifiedsuccessfully”);

} else {

System.out.println(“title not verified successfully”);

}

// Enter the username

driver.findElement(By.name(“username”)).sendKeys (“Kadmin”);

// Enter the password

driver.findElement(By.name(“password”)).sendKeys (“K@admin”);

// Clicking On Login Button

driver.findElement(By.xpath(“//*[@id=’content’]/ div/div/div/div/div[2]/form/div[3]/button”)).cli ck();

// Identify and get the Dashboard Text

String text = driver.findElement(By.xpath(“//*[@id=’content’]/div[1]/div/h1”)).getText();

// Print the Dashboard Text

System.out.println(text);

// To verify whether the welcome page successfully opened or not

if (text.equals(“Dashboard”))

{

System.out.println(“Welcome pageverified successfully”);

} else {

System.out.println(“Welcome page not verified successfully”);

}

// Clicking On Logout Button

driver.findElement(By.xpath(“//*[@id=’header’]/u l/li[3]/a”)).click();

//Close the current Firefox Browser driver.close();

}

}

SELENIUM | BROWSER COMMANDS :

1.get() : This will be used to navigate the application url

Syntax : driver.get(“appURL”);

2.getTitle() : This will be used to get the title of the current Webpage.

Syntax : driver.getTitle();

3.findElement() : By using this we can identify single webelement On a webpage.

Ex: Button, checkbox, radio button etc.

Syntax : driver.findElement(By.Locator(“Locator-Value”));

4.findElements() : By using this we can identify list of webelements On a webpage.

Ex :

  1. Suppose if you want to identify dropdown values at a time then we use findElements method.
  2. Suppose if you want to identify list of frames in a webpage then we use findElements method.
  3. Suppose if you want to identify list of links in a webpage then we use findElements method.

Syntax :

List<WebElement> total_Links = driver.findElements(By.tagName(“a”));

5.sendKeys() : If you want to give the value to the input field(textbox,text area) then we use sendkeys method.

Syntax :

driver.findElement(By.locator(“locator-value”)).sendKeys(“text”);

6.getText() : If you want to get the particular text in a webpage then we use getText method.

Syntax :

String PageText=driver.findElement(By.Locator(“Locator-value”)).getText();

7.click() :Is there any click operation in your application then we use click().

Syntax :

driver.findElement(By.Locator(“Locator-value”)).click();

8.close() : This will be used to close the current browser window.

Syntax : driver.close();

Important Interview Questions :

1. How to Identify WebElement in selenium webdriver?

A )By using firebug and firepath we can Identify

WebElement.

2. Can we use firebug and firepath for chrome and Ie?

No,

1.Here firebug and firepath these two add-ons only for firefox.

2.Suppose if u want to identify the WebElement In chrome and ie here no need to install firebug and firepath. Becoz chrome and ie have its won developer tool to identify the web element.

3. What is the default package of selenium?

  1. org.openqa.selenium

4. What is the difference between findElement() and findElements()?Find ElementsfindElement() :

By using this we can identify single webelement On a webpage.

Ex : Button, checkbox,radio button etc.

Syntax : driver.findElement(By.Locator(“Locator-Value”));

TestSteps :

  • open the firefox browser
  • navigate the application url Enter the username
  • Close the current Firefox Browser

Selenium Program :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class findElementMethod {

public static void main(String[] args) throws Interrupted Exception {

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

// Enter the username

driver.findElement(By.name(“username”)).sendKeys (“Kadmin”);

//Close the current Firefox Browser

driver.close()

}

}

findElements() : By using this we can identify list of webelements On a webpage.

Ex :

  • Suppose if you want to identify dropdown values at a time then we use findElements method.
  • Suppose if you want to identify list of frames in a webpage then we use findElements method.
  • Suppose if you want to identify list of links in a webpage then we use findElements method.

Syntax :

List<WebElement> total_Links = driver.findElements(By.tagName(“a”));

TestSteps :

  • open the firefox browser
  • navigate the application url
  • Identify all the links and store into total_Links variable Print the total Links on a webpage
  • Close the current Firefox Browser

Selenium Program :

package seleniumProject;

import java.util.List;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

public class findElementsMethod {

public static void main(String[] args) throws InterruptedException {

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

//Identify all the links and store into total_Links variable

List<WebElement> total_Links = driver.findElements(By.tagName(“a”));

//Print the total Links on a webpage

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

//Close the current Firefox Browser

driver.close();

}

}

5.How to verify particular text on a webpage using selenium webdriver?  (Or) How to verify successful message on a webpage using selenium webdriver?

TestSteps :

  • open the firefox browser
  • navigate the application url Enter the username
  • Enter the password
  • Clicking On Login Button
  • Identify and get the Dashboard Text Print the Dashboard Text
  • To verify whether the welcome page successfully opened or not Clicking On Logout Button
  • Close the current Firefox Browser

Selenium Program :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class SampleClass {

public static void main(String[] args) throws Interrupted Exception {

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

// Enter the username

driver.findElement(By.name(“username”)).sendKeys (“Kadmin”);

// Enter the password

driver.findElement(By.name(“password”)).sendKeys (“K@admin”);

// Clicking On Login Button

driver.findElement(By.xpath(“//*[@id=’content’]/

div/div/div/div/div[2]/form/div[3]/button”)).click();

// Identify and get the Dashboard Text

String text =

driver.findElement(By.xpath(“//*[@id=’content’]/ div[1]/div/h1”)).getText();

// Print the Dashboard Text

System.out.println(text);

//To verify whether the welcome page successfully opened or not

if (text.equals(“Dashboard”))

{

System.out.println(“Text matched”);

} else {

System.out.println(“Text notmatched”);

}

// Clicking On Logout Button

driver.findElement(By.xpath(“//*[@id=’header’]/u l/li[3]/a”)).click();

//Close the current Firefox Browser

driver.close();

}

}

Control statements :

Syntax :

If(Actual_value.equals(Expected_value))

{

//Execute the code if condition is true

}else

{

//Execute the code if condition is false

}

Actual_value : Take the text from Testing Application.

Expected_value : client requirement

6.Difference between close() and quit() in selenium webdriver ?
Driver.close() :

By using this we can close the current browser window.

I.e Single window on which driver is having focus that will be closed only

Difference between close() and quit() in selenium webdriver

Driver.quit() : Every associated browser will be closed

I.e closed all the windows opened by the driver.

7. What is the purpose of public static void main() in java ?

public :

Since main() should be available to JVM. It should be declared as public.I f we don’t use main() as a public then it doesn’t make itself available to JVM and JVM cannot execute it.

Static :

We should be call the main() without creating an object, such methods are called static methods and we should be declared as static.

Void :

If main() it does not written any value then you have to put void(no value) before the main().

main():

If main() is not written in the java program then JVM will not execute the program.main() is the starting point for JVM to start execution of java.

What are the pre-requisites to run the selenium web driver?
  1. JDK 8
  1. Eclipse IDE
  1. Selenium JAR file
  1. Testing Application
  1. Browser (Firefox 53.0)
  1. Firebug
  1. Firepath

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

How to verify multiple checkboxes in a webpage using selenium?

Selenium Training in Hyderabad

kosmik technologies is the best institute for selenium training in Hyderabad. we offer classroom and selenium online training courses by certified faculty. Selenium is an open source tool for web application testing. This tool primarily developed in JavaScript and browser technologies and hence supports all major browsers on all the platforms. Selenium is one of the best tool available in the market for a web application.

SOFTWARE TESTING TECHNIQUES
 
 

 SOFTWARE TESTING TECHNIQUES

SOFTWARE TESTING TECHNIQUES:

 
Some of the software testing techniques given below:
 
1) Process: It is a single activity or testing process.
 
2) All Life Cycle Activities:
 
It is an activity or it is a process.It covers Software development life cycle (SDLC). In earlier days the life cycle can end the defects. Designing the tests from the being introducing code. Sometimes it may stated as test basis verify by the test design. Requirements and design specifications which used to test basis.
 
3) Planning:
 
 Planning includes that what they want to do. And it is control the test activities. Test progress reported, and knowing about the software test.
 
4) Static Testing: 
 
This testing is eliminating the code the test conducted. And find the defects. The test was going when verification process done. Static analysis and document reviews are including the test. This is cost effective test and it is very useful. Ex: inspection, reviewing and walk through.
 
5) Dynamic Testing:
 
In this testing the running tests results are administrate. By eliminating the software code. Validation code it done. Ex. system testing, integration testing, and unit testing etc.
 
6) Preparation:
 
In this we have to the type of testing. Depending on designing cases and test conditions.
 
7) Evaluation:
 
This test evaluated as the middle of the test. We have to refer the result of the test. It evaluates the software and knows about completion criteria. The test finished or not and the software passed the test known by the help of this test.
 
8) Software products and related work products:
 
This related to Testing of designing the testing of code. Along with the rule and the designing specification. It related to the training material and operation documents are having equal importance.
 
 

SOFTWARE TESTING:

 
It is a process of eliminating the software bugs. And software testing is the process of assassinate a programming applications.
 
· It can also be refer as the process of verifying and validating . The software programs or products or applications.
 
· Expected works.
 
· Software implemented with the equal characteristics.
 
· It meets the technical and business requirements by the development and design.
SpecFlow Feature File

History of SpecFlow Feature File

 

What is SpecFlow Feature File?

A feature file is an entryway to the SpecFlow test. That is a file where identify lab tests in Descriptive language. It an important part of SpecFlow, as it functions as an automation test script as well as live documents.

 History of SpecFlow Feature File

An attribute file can contain a scenario or many scenarios within a feature data file. it usually contains a set of cases. Let’s create one such file.
The head for writing the first script, let’s create a nice folder composition of the task.

Create a Feature File Folder

It will always be good to have a nice and clean folder framework in the job.Each folder signifies this content in it. So, first build a folder for the feature file.
1) Create a new Folder by right click on the ‘Task’ and navigating to include -> New Folder.
2) Name the folder as ‘Features’ and hit enter.
After the folder for feature document created, we have been all set to make a feature file.

Create a Feature File

1) Over the Feature folder Right-click and navigate to include -> New Item.
2) Select SpecFlow Feature File in the center. it logical name, with regard to this guide, please use the same name ‘LogIn_Feature’.
For SpecFlow to find the testimonies, It will need to make sure that they carry the ‘.feature’ file extension.
3) Write first feature file for LogIn Scenario.

Gherkin

A language named Gherkin. it implements the concepts of Business readable area specific language(BRDSL). Site-specific language provides the capability the application behavior without details of implementation.

If we have now come back to BDD/BRDSL we will see that we are able to describe checks in a more readable format. In the above test it’s quite clear and obvious, by reading, what test would do. At exactly the same time of being a test drive, it also documents the habit of application. The true power of BDD/BRDSL and it’ll become the electricity of cucumber works on the same principles.

Keywords

Now moving forward we have described a test. You will notice colored part of the tests. They are keywords described by Gherkin.
Feature: Defines what feature you will be testing in the assessments
Given: Tells the pre-condition of the test
And: Defines extra conditions of the test
When: Defines the action of the test
Then: Says the postcondition. Able to say that it’s expected result of the test

 History of SpecFlow Feature File 

We provide History of SpecFlow Feature File in real time training. We offer selenium training in Hyderabad by real-time project Training.

Save

Selenium Test using NUnit Framework

Selenium Test using NUnit Framework

What is NUnit Framework?

NUnit is a unit testing platform for performing unit testing based on the .NET platform. It is a trusted tool for unit testing and is preferred by many designers today selenium training in Hyderabad.

Selenium Test using NUnit Framework

NUnit absolved to use. NUnit does not create any test scripts alone. write test scripts on own, but NUnit gives to work with its tools and classes to make product trials easier. The details to keep in mind about NUnit are listed below:

  • NUnit is no automated GUI testing tool.
  • It is not a scripting dialect, all tests written in .NET backed languages, e.g., C#, VC, VB.NET, J#, etc.

What is NUnit Adapter?

The NUnit Test Adapter gives you to run NUnit testing inside Visual Studio.

Steps to Download and Install NUnit Construction using the NuGet Deals?

1) Go to Recommendations >> Manage Nuget Plans… from the answer Explorer window from the right side.
2) Type Nunit in the Search pack. This will need few seconds to find the right tool. Locate (seek out) NUnit in the center panel and showcase it by selecting it and Click Install.

Steps to Download and Install NUnit Adapter using the Extension Manager?

1) From within Visual Studio, go to Tools >> Extensions and Posts.
2) Seek out NUnit Test Adapter as soon as found select Install button.

How to choose between Expansion and NuGet package

The Extension will apply to Visual Studio room itself and can work with all projects you use. All users of your solution need to set up the Extension.
The Deal will apply to the solution and can work for any other end user too, as it follows the solution.

Steps to Create a NUnit Test

The very first thing need to do is to make a new course and write test code in that.
1) Right Click on the Project in the Solution Explorer and choose Add >> Class.
2) Give your Course name ‘NUnitTest’ and select Finish button. This will bring up a sugary class creation window.
3) Write the selenium code for the next steps

  • Take up a FireFox Browser
  • Start Website in the web browser started out by Selenium
  • Close the Browser

4) Separate the code into three different parts:

  • Take up a FireFox Browser: Initialize
  • Start Website in the internet browser began by Selenium: OpenTestApp
  • Close the Web browser: EndTest

5) Now Build the solution again by doing Build >> Build Solution.
6) Now use NUnit Annotations to specify your test. Use [SetUp], [Test] & [TearDown] for the three methods created above for every single action. And again run the Build
7) It’s enough time to run the NUnit test. To perform the test, Right Click in the Code window and choose Run Tests.

Steps to make a New Package

Now we are moving to learning Selenium. We are doing a lot of practice for Selenium Code. so it makes sense to create a different package for all the Selenium Test. To achieve that, we need to create a fresh folder into the project solution.
1) Right Click on the Project and select Add >> New Folder and name it Selenium Basics.

Selenium Test using NUnit Framework

We provide Selenium Test using NUnit Framework in real time training. We offer classroom and project training for selenium training in Hyderabad.

How to Handle Multiple Browsers in Selenium CSharp

Handle Multiple Browsers in Selenium CSharp

 

How to Handle Multiple Browsers in Selenium CSharp

There many windows via Selenium web drivers. that clicking on a link which opens the page in a fresh browser screen. Selenium web drivers keep tabs on glass windows it opened throughout a session. Any browser windowpane Exposed Opened by a prior treatment of Selenium Webdriver period. We mean the duration of the time instantiates a WebDriver occasion enough time. we kill it via WebDriver.Give up or by hand killing the process.

Handle Multiple Browsers in Selenium CSharp

This will click on the “New Browser Windowpane” button 3 times. As a result, you will see 4 house windows that will come into existence. Take into account window opened during driver initialization is the Parent home window.

How to Handle Screen in Selenium CSharp?

To identify a web browser Selenium WebDriver map of Opened windows VS Window Deal with. It distinctive string value identifies an Internet browser screen on the desktop. It guaranteed that every browser will have a unique window cope with. To get Screen handle WebDriver program provides two methods CurrentWindowHandle – WindowHandles

The current window handle method returns a string value. its profits the Window take care of current focused browser windows. WindowHandles. This method results in a ReadOnlyCollection of all Window handles browsers opened period.

Console Output: This is the output that gets on the system. Focus on the Window take care of values, they can be unique to the other person

The way to handle Many House windows in Selenium CSharp?

Their idea of currently focused windows selenium web driver commands focused home window. By default the emphasis definitely on the Parent windowpane, please start the screenshot. To shift concentrate from Parent Window to any child home window. We use the next command line on WebDriver – driver.SwitchTo(). Home window This control takes in a window handle and switches the driver context on that screen. Once the Transition happens all the driver commands will go to the focused home window. That important to comprehend, without switching to the desired window. we will never be able to perform any action on that windowpane. Which across all the open up glass windows and navigates to a specific page in every the open windows one at a time.

Concluding all the Windows

There quite two commands. that people use to close browser windows WebDriver.close() and WebDriver.Quit().

WebDriver.Close() command line will close the current window on which the focus is present. This used to close glass windows. The windows would like to nearby use the right Window take care. the call the WebDriver.Close command word. That may close the existing browser window.

WebDriver.Quit()

It will close all the house windows exposed in the program. This command shuts down the driver instance and WebDriver leads to the exception. That’s pretty much it that people have for handling many windows.

Handle Multiple Browsers in Selenium CSharp

We provide Handle Multiple Browsers in Selenium CSharp by real time experts.We provide real time project training for selenium training in Hyderabad.
 

Save

Different types of Alert And Popup Box in Selenium CSharp

Different types of Alert And Popup Box in CSharp

 

Different types of Alert And Popup Box in Selenium CSharp

Alert is a pop-up window that arises on screen. There are various user activities that can cause an alert on display. customer clicked on a button that displayed a note or when you entered a form. HTML web page asked you for some extra information. We understand to Handle kinds of Alert And Popup Container in Selenium CSharp.

Different types of Alert And Popup Box in CSharp

Alerts are different from regular house windows. The primary difference is the fact that alerts are blocking in nature. They will not allow any action on the root web page if they are present. So if an alert exists on the website and make an effort to access any of the factors in the fundamental page

Handling Alerts using Selenium WebDriver

Selenium provides us with a software called IAlert (It is an Interface).
It is present in the OpenQA.Selenium.IAlert package deal. Alert interface gives us following methods to deal with the alert:

  • Accept() To accept the alert
  • Dismiss() To dismiss the alert
  • Content material To get the text of the alert
  • SendKeys() To create some text message to the alert

Simple Alert

Simple alerts have an OK button on them. They used to display some information to an individual. The first alert on our test web page is a straightforward alert. The following code will browse the text message from the Alert and then allow the alert. the note that people swap from the main windowpane with an alert using the driver.SwitchTo().Alert().

Confirmation Alert

This alert possesses an option to accept or dismiss the alert. To accept the alert use IAlert.Accept() and also to dismiss use the IAlert.Dismiss().

Prompt Alerts

In prompt alerts, get an option to add text to the alert container. This used when some input is necessary from an individual. We use the SendKeys() method to type something in the Prompt alert box.

Different types of Alert And Popup Box in CSharp

 We provide Different types of Alert And Popup Box in CSharp by real time experts. We offer corporate and online training for selenium training in Hyderabad.

 

Save