Salesforce With Selenium

Salesforce With Selenium

This is my First post for Salesforce with Selenium. In this post, we will understand why we use selenium in salesforce and how we are using selenium with salesforce. We will also look into what results are achieved by using selenium.

This post based on WHW. 

WHW stands for Why How and What

salesforce automation

1. WHY:  As we all know Salesforce has its own unit testing classes to test the apex code but these classes have their own limitations. That is why we are coming up with integration between Selenium and Salesforce to overcome these limitations. Let us now discuss the Open Source Automation Tool  "Selenium". 

Selenium: We are using Selenium WebDriver because Selenium IDE has many limitations which are as follows:

  • Its works on Mozilla Browser
  • It is a GUI Plug-in


2. HOW: We need to install Selenium, along with another software.

Installation of Selenium:

Please Click here for Installation.

We have taken a simple login scenario for Salesforce.

Login in Salesforce:

Here is a screenshot of Code

login to salesforce


Sample Code:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class LoginInSalesforce {
    private static WebDriver driver; 
    public static WebDriverWait wd;  
    public static void main(String[] args) throws IOException, InterruptedException { 
        System.setProperty("", new File(".").getCanonicalFile()+ "\\Drivers\\Chrome\\chromedriver.exe"); 
        driver= new ChromeDriver(); 
        System.out.println("Opening URL"); 
        wd= new WebDriverWait(driver, 30); 
        // Enter username in textbox 
        System.out.println("Enter username in textbox"); 
        driver.findElement(By.xpath("//input[@id='username']")).sendKeys("Type your UserName" ); 
        //Enter Password in textbox 
        System.out.println("Enter Password in textbox"); 
        driver.findElement(By.xpath("//input[@id='password']")).sendKeys("type your password");
        //Click on Login button 
        System.out.println("Click on Login button"); 
        System.out.println("Login Sucessfully"); driver.close(); 

3. What:  Here I have attached a video of the automation process.

Apex Test Classes + Selenium= Good Salesforce App Quality


Popular Salesforce Blogs