I need to create simple autotest using ChromeDriver with Maven.
excerpt from pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
test case:
@BeforeTest
public void StartBrowser_NavURL() {
driver = new ChromeDriver();
driver.manage().window().maximize();
}
@AfterTest
public void CloseBrowser() {
driver.quit();
}
@Test
public void testToCompareDoubles() {
driver.get("http://www.google.com");
}
And after running test executing command
mvn -test
I receive the following exception:
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:199) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109) at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116) at com.testTask.GoogleTest.StartBrowser_NavURL(GoogleTest.java:26) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:110) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:106) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) ... Removed 23 stack frames
I've read discussion accesible via the link below: How to run Selenium WebDriver test cases in Chrome?
But I can't download executables on my server. So, it's not an option for me. But Maven downloads "selenium-chrome-driver-2.53.1.jar" on the server (which is OK for me).
Is there a way to use dowloaded .jar file instead of executable?
P.S. For this project I use IntelliJ Idea Community Edition and I'm not an expert with it