What is Selenium?

    • Selenium is one of the most popular Test Automation Tool available in the market
    • Selenium automates Web Applications and Mobile applications .
    • Selenium cannot automate Desktop applications
    • Selenium is an Open Source Tool
      • Open Source Software – Software’s who’s source code can be publicly accessible and can be used by other developers/communities to view, modify or enhance or share it for different reasons.
    • Selenium is Free
      • No licensing cost is involved
    • Selenium can be used to execute the automation tests across the following different supported browsers
      • Chrome
      • Firefox
      • Internet Explorer
      • Safari
      • Opera
    • Selenium can be used to execute the automation tests across the following different operating systems
      • Microsoft Windows
      • Apple OS X
      • Linux
    • Selenium automation scripts can be developed using any of the following programming languages:
      • Java (Mostly used, famous and also has lot of support in the market)
      • Python
      • C#
      • Ruby
      • Perl
      • PHP

 

What are the different components of Selenium?

    • Selenium is not a single tool, instead it is a suite of tools
    • Instead Selenium is the combination of the following different tools or components
      • Selenium IDE
        • Record and Playback Tool
        • Cannot be used for complex applications
      • Selenium RC (Outdated)
        • Used to be the major tool earlier till the Selenium WebDriver came into the market with more benefits.
      • Selenium WebDriver
        • Major tool of Selenium in the current market
      • Selenium Grid
        • Used to support parallel execution by distributing the tests across multiple machines

 

What are the different versions of Selenium?

    • Selenium 1
      • Selenium 1 = Selenium IDE + Selenium RC + Selenium Grid
    • Selenium 2
      • Selenium 2 = Selenium IDE + Selenium WebDriver 2.x + Selenium RC + Selenium Grid
    • Selenium 3
      • Selenium 3 = Selenium IDE + Selenium WebDriver 3.x + Selenium Grid

 

What are Locators?

>Locators help Selenium in finding the UI elements on the Web Page

Locaters in Selenium

below you can find the different types of locators we can use in

Selenium:

    • ID
    • Name
    • Class Name
    • Link Text or Partial Link Text
    • CSS Selectors
    • XPath
    • DOM TagName

 

What are the different Types of drivers that are available in Selenium WebDriver

The following are the different types of drivers available in Selenium WebDriver:

    • ChromeDriver
    • For executing Selenium Automation Scripts on Chrome Browser
    • FirefoxDriver
    • For executing Selenium Automation Scripts on Firefox Browser
    • InternetExplorerDriver
    • For executing Selenium Automation Scripts on Internet Explorer Browser
    • SafariDriver
    • For executing Selenium Automation Scripts on Safari Browser
    • OperaDriver
    • For executing Selenium Automation Scripts on Opera Browser
    • EdgeDriver
    • For executing Selenium Automation Scripts on Edge Browser
    • EventFiringWebDriver
    • For firing the WebDriver listener events
    • RemoteWebDriver
    • Used with Selenium Grid for executing automation scripts on different remote machines.

 

To verify whether the element is visible or not on a Webpage ?

Test Steps :

    • Launch the Firefox browser
    • Navigate to AppUrl
    • Wait 5sec
    • To verify whether the Kosmik Jobs element is visible or not on a Webpage ?

 

Selenium Code :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Verify_Element_DisplayedorNot {

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

//Launch the Firefox browser

WebDriver driver = new

FirefoxDriver();

//Navigate to AppUrl

driver.get("https://www.kosmiktechnologies.com/jobs/");

//Wait 5sec

Thread.sleep(5000);

//To verify whether the Kosmik Jobs element is visible or not on a Webpage ?

if(driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/d iv/div/div/h2/em")).isDisplayed())

{

System.out.println("Kosmik Jobs Element is visible");

}else

{

System.out.println("Kosmik  Jobs Element is Invisible");

 

        }

     }

}

To verify whether the element is Enable or Disable on a Webpage?

Test Steps :

  • Launch the Firefox browser
  • Navigate to AppUrl
  • Wait 5sec
  • To verify whether the Kosmik Jobs element is Enable or Disable on a Webpage ?

 

Selenium Code :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Verify_Element_EnabledorNot {

public static void main(String[] args) throws

InterruptedException {

//Launch the Firefox browser

WebDriver driver = new FirefoxDriver();

//Navigate to AppUrl

driver.get("https://www.kosmiktechnologies.com/jobs/");

//Wait 5sec

Thread.sleep(5000);

//To verify whether the Kosmik Jobs element is Enable or Disable on a Webpage ?

if(driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/d iv/div/div/h2/em")).isEnabled())

{

System.out.println("Kosmik Jobs Element is Enable");

}else

{

System.out.println("Kosmik  Jobs Element is Disable");

         }

   }

}

How to verify particular text in a webpage? Or How to verify successfull message in selenium?

Test Steps :

  • Launch the Firefox browser
  • Navigate to AppUrl
  • Wait 5sec
  • Identify and get the Kosmik Jobs text and store into jobs_Text variable
  • Print the Kosmik Jobs text
  • verify Kosmik Jobs text
  • Close the current browser window

 

Selenium Code :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Verify_KosmiK_JobsText {

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

{

//Launch the Firefox browser

WebDriver driver = new FirefoxDriver();

//Navigate to AppUrl driver.get("https://www.kosmiktechnologies.com/jobs/");

//Wait 5sec

Thread.sleep(5000);

//Identify and get the Kosmik Jobs text and store into jobs_Text variable

String

jobs_Text=driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div/div/h2/em")).getText();

//Print the Kosmik Jobs text

System.out.println(jobs_Text);

//verify Kosmik Jobs text

if(jobs_Text.equals("JOBS"))

{

System.out.println("Kosmik Jobs Text verified successfully");

}else

{

System.out.println("Kosmik Jobs Text not verified successfully");

}

//Close the current browser window

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

How to verify particular text in a webpage

 

 

KOSMIKTECHNOLOGIES CLASS IS ONE OF THE BEST DEVOPS  OFFLINE & ONLINE TRAINING INSTITUTES IN HYDERABAD, KUKATPALLY/KPHB

Devops training institutes Hyderabad, Kukatpally at kosmik Training Institute covers topics from beginner level to advanced level. Finally, by the end of Devops Course in Hyderabad you can be confident with DevopsTraining in hyderabad.

Devops training in Kukatpally,KPHB consists of assignments and completely real-time practical Devops job oriented training in Hyderabad . He explains the difficult topics for beginners with ease, provides best Devops examples and makes the student comfortable with the Devops cloud computing training in hyderabad .

 

 

Kosmik is the best Devops training institute Hyderabad,KPHB. We are providing Devops Training in hyderabad & lab facilities with complete real-time Devops trainingDevops Training in Kukatpally is based on complete advance concepts. So that you can get easily "hands-on experience". We will give 100% job assistance.Devops Training in kphb, PYTHON Training in Kukatpally,Devops Training in Telangana, Devopstraining institutes in hyderabadDevops course in hyderabad.