Skip to content

Instantly share code, notes, and snippets.

@4M01
Created September 10, 2016 13:37
Show Gist options
  • Save 4M01/26f892ee6503a27ed024f6237329ae6a to your computer and use it in GitHub Desktop.
Save 4M01/26f892ee6503a27ed024f6237329ae6a to your computer and use it in GitHub Desktop.
createInstance() is method that returns Chrome WebDriver object with Proxy setting unchecked.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
/**
* Created by Amol Chavan on 9/10/2016.
*/
public class DriverFactory {
public static WebDriver createInstance(){
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-proxy-server");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
System.setProperty("webdriver.chrome.driver","C:\\Grid\\chromedriver.exe");
WebDriver driver = new ChromeDriver(capabilities);
driver.get("http://www.google.com");
return driver;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment