Launch Firefox Browser

package com.firefox;

import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;

public class FirefoxDemo {
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  System.setProperty("webdriver.gecko.driver", "J:\\Softwares\\drivers\\geckodriver.exe");
  
  //Launch an existing Firefox profile
  ProfilesIni allProfile = new ProfilesIni();
  FirefoxProfile profile = allProfile.getProfile("selenium");
  FirefoxDriver driver = new FirefoxDriver(profile);
  driver.get("http://www.google.co.in");
  driver.manage().window().maximize();
  
  //Launch default firefox profile
  driver = new FirefoxDriver();
  driver.get("http://www.facebook.com"); 
 }
}

No comments:

Post a Comment