Wednesday, May 8, 2019


Open Application in the Different Browsers Through Selenium Java

Below are the Scripts for the Selenium Java

// Open the application in the Chrome browser

package Package;

//import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

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


public class AzziAutomation
  {

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

 
//*************************** RUNNING CHROME DRIVER  *************

 System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe");
  WebDriver driver = new ChromeDriver();


 String url ="http://www.xpr2t.com/Webobjects.html";

// Maximize the browser
driver.manage().window().maximize();
// Open the application in the browser
  driver.get(url );

   driver.close();
  driver.quit();

}
}



//  Open the application in the Firefox browser using Selenium Java

package Package;

//import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

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


public class AzziAutomation
  {

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

//***********************************RUNNING IN FIREFOX *************************************************
 
 
// System.setProperty("webdriver.gecko.driver", "C:\\firefoxdriver\\geckodriver.exe");
// WebDriver driver = new FirefoxDriver();



 String url ="http://www.xpr2t.com/Webobjects.html";

// Maximize the browser
   driver.manage().window().maximize();  
// Open the application in the browser
    driver.get(url );

   driver.close();
  driver.quit();

}
}


//  Open the application in the Internet explorer browser using Selenium Java

package Package;

//import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

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


public class AzziAutomation
  {

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

//Running in the Internet Explorer

//  System.setProperty("webdriver.ie.driver", "C:\\iedriver\\IEDriverServer.exe");
// WebDriver driver = new InternetExplorerDriver();


 String url ="http://www.xpr2t.com/Webobjects.html";

// Maximize the browser
   driver.manage().window().maximize();  
// Open the application in the browser
    driver.get(url );

   driver.close();
  driver.quit();

}
}


//  Open the Chrome application in Mac  - IOS  - apple mac laptop

package Package;

//import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

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


public class AzziAutomation
  {

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

//MAC
system.setProperty("webdriver.chrome.driver",File.seperator+"User"+File.seprator+"downloads"+File.seperator+"chromedriver");
 
  WebDriver driver = new ChromeDriver();

 String url ="http://www.xpr2t.com/Webobjects.html";

// Maximize the browser
   driver.manage().window().maximize();  
// Open the application in the browser
    driver.get(url );

   driver.close();
  driver.quit();

}
}




No comments:

Post a Comment