Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to set path, when repo is downloaded using gradle
    primarykey
    data
    text
    <p>I am using gradle to download the selenium chrome driver from maven </p> <p><code>webtestsCompile 'org.seleniumhq.selenium:selenium-chrome-driver:2.32.0'</code></p> <p>I am trying to use this directly and I see that I get this error :</p> <pre><code> Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list </code></pre> <p>I have looked up a couple of questions from stack-overflow and other places it requires me to set the value of the property webdriver.chrome.driver to the location where I have downloaded with some-thing like this :</p> <pre><code>System.setProperty("webdriver.chrome.driver", "path to chrome-driver"); </code></pre> <p>I am wondering what is the best way to go about this ? </p> <p>EDIT 1:</p> <p>I verified the java.class.path a snippet of this path looks like this : </p> <pre><code>/home/bhavya/.gradle/caches/artifacts-26/filestore/org.seleniumhq.selenium/selenium-chrome-driver/2.32.0/jar/14a4e8e32a4129c682c67381f5d7bf11f2327e1/selenium-chrome-driver-2.32.0.jar </code></pre> <p>This looks like the selenium-chrome-driver is present in the java.class.path. </p> <p>Edit 2 : </p> <p>I would want the chrome driver to work irrespective of the operating system that I am using, currently I am on a ubuntu box but a lot of this will get tested on a windows box. When I hard coded the value of the webdriver.chrome.driver to the value in EDIT 1, I am facing the following issue : </p> <pre><code> java.lang.IllegalStateException: The driver is not executable: /home/bhavya/.gradle/caches/artifacts-26/filestore/org.seleniumhq.selenium/selenium-chrome-driver/2.32.0/jar/14a4e8e32a4129c682c67381f5d7bf11f2327e1/selenium-chrome-driver-2.32.0.jar </code></pre> <p>Edit 3 : </p> <p>Task within which I am running the test suite --</p> <pre><code>task webs(type: Test, dependsOn: updateNodeModules) { testClassesDir = sourceSets.webtests.output.classesDir classpath = sourceSets.webtests.runtimeClasspath def javaHomeBin = new File(System.getProperty("java.home"), "bin"); def javaExec = new File(javaHomeBin, "java").getAbsolutePath(); systemProperties['jar.path'] = jar.archivePath if(project.hasProperty('url')){ println" url passed as variable is $url" systemProperties["selenium.webdriver.url"] = "$url" } systemProperties["selenium.webbrowser.type"] = "firefox" if(project.hasProperty('browser')){ println "the browser passed is $browser" systemProperties["selenium.webbrowser.type"] = "$browser" } include '**/UserEditControllerWebTest.class' doFirst { println " iterator is $it" def chrome=configurations.testRuntime.find { it.name.contains("selenium-chrome-driver") }.path println " chrome driver path is $chrome" systemProperties["webdriver.chrome.driver"]= "$chrome" } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload