Created
June 18, 2012 16:56
-
-
Save fforbeck/2949393 to your computer and use it in GitHub Desktop.
config para subir o chrome com selenium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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