How to Run the Script in the Chrome Browser


                                    How to Run the Script in the Chrome Browser

      1. Create new Java Project
                [Name of the project is "FFTesting"             
      2. Create a new Java class file under the Package
                [Give a name of the class is "Runtesting.java"
      3. Download ChromeDriver server
           First of all, download latest version of ChromeDriver server for webdriver software                        testing tool. from https://sites.google.com/a/chromium.org/chromedriver/downloads

            Download the file and extract in the folder. You get "chromedriver.exe"
    
      4. Next add the selenium server Jar files to the Project. Download Selenium Server
                [Right click on the Project Name, Mouse over on Build Path and select 'Configure Build Path',                  Select Libraries tab, Click on Add External Jars and select the selenium server jar from your                   local machine]
       5. .Write the script in the Java and execute it.
            Please find the below example program to open Google in chrome browser
              System.setProperty("webdriver.chrome.driver","path of that chromedriver.exe file");


import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;

public class Runtesting{
   public static void main(String[] args) {
      System.setProperty("webdriver.chrome.driver","path of that chromedriver.exe file");
      WebDriver driver = new ChromeDriver();
   
      //Launch website
      driver.navigate().to("http://google.com/");
      
      //Maximize the browser
      driver.manage().window().maximize();
      
      //Close the Browser.
      driver.close();
   }
}
               

How to Run the Script in the Firefox Browser


                                    How to Run the Script in the Firefox Browser

      1. Create new Java Project
                [Name of the project is "FFTesting"             
      2. Create a new Java class file under the Package
                [Give a name of the class is "Runtesting.java"
       3. Next add the selenium server Jar files to the Project. Download Selenium Server
                [Right click on the Project Name, Mouse over on Build Path and select 'Configure Build Path',                  Select Libraries tab, Click on Add External Jars and select the selenium server jar from your                   local machine]
       4. .Write the script in the Java and execute it.
            Please find the below example program to open Google in Firefox browser
              
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Runtesting{
   public static void main(String[] args) {
   
      WebDriver driver = new FirefoxDriver();
   
      //Launch website
      driver.navigate().to("http://google.com/");
      
      //Maximize the browser
      driver.manage().window().maximize();
      
      //Close the Browser.
      driver.close();
   }
}
               

Handling Dynamic Elements in Selenium WebDriver

                       Handling Dynamic Elements in Selenium WebDriver Dynamic elements are those elements which have identifiers that a...