Skip to content

Instantly share code, notes, and snippets.

@fforbeck
Created June 18, 2012 16:56
Show Gist options
  • Save fforbeck/2949393 to your computer and use it in GitHub Desktop.
Save fforbeck/2949393 to your computer and use it in GitHub Desktop.
config para subir o chrome com selenium
public WebDriver chrome() {
try {
//MAC - Deve instalar o servidor web driver antes http://code.google.com/p/chromedriver/downloads/list
//System.setProperty("webdriver.chrome.driver", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
//LINUX - Deve instalar o servidor web driver antes http://code.google.com/p/chromedriver/downloads/list
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
final DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
desiredCapabilities.setBrowserName("chrome");
desiredCapabilities.setVersion("18");
desiredCapabilities.setPlatform(Platform.LINUX);
desiredCapabilities.setJavascriptEnabled(true);
desiredCapabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
return new RemoteWebDriver(new URL("http://localhost:9515"), desiredCapabilities);
} catch (Exception e) {
LOGGER.error(e.getMessage());
LOGGER.error("Não foi possível abrir o navegador chrome."
+ " Verifique se o servidor local chrome-driver está no ar"
+ " ou se a propertie 'webdriver.chrome.driver' está correta");
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment