Created
December 7, 2016 15:17
-
-
Save hristo-vrigazov/943ec837153259e97b954295548e303d to your computer and use it in GitHub Desktop.
Starting Chrome in headless mode
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
package config; | |
import java.io.File; | |
import java.io.IOException; | |
import org.junit.Test; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
import org.openqa.selenium.chrome.ChromeDriverService; | |
import com.google.common.collect.ImmutableMap; | |
/** | |
* Created by hvrigazov on 06.12.16. | |
*/ | |
public class ExperimentsTest { | |
@Test | |
public void experiment() throws InterruptedException, IOException { | |
ChromeDriverService chromeDriverService = new ChromeDriverService.Builder() | |
.usingDriverExecutable(new File("/home/hvrigazov/chrome_driver/chromedriver")) | |
.usingAnyFreePort().withEnvironment(ImmutableMap.of("DISPLAY", ":1")).build(); | |
chromeDriverService.start(); | |
WebDriver driver = new ChromeDriver(chromeDriverService); | |
driver.quit(); | |
chromeDriverService.stop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment