Exception in thread "main" java.lang.IllegalStateException:

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception in thread "main" java.lang.IllegalStateException:

Sonu Sharma
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
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.firefox.GeckoDriverService.access$000(GeckoDriverService.java:37)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:95)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:238)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127)
at pack.New.main(New.java:13)


I'm running simple code in eclipse and getting above error

package pack;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class New {

 public static void main(String[] args) {
  //set geckodriver path.
//System.setProperty("webdriver.gecko.driver","D:\\selenium\\geckodriver-v0.21.0-win64\\geckodriver.exe");
  //initialize firefox driver object to open firefox browser.
    WebDriver driver = new FirefoxDriver();
    //open URL in browser.
    driver.get("http://google.com/");
    String i = driver.getCurrentUrl();
    System.out.println(i);
    driver.close();
   }
}

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/774a7115-4f8c-4a66-b694-369beebb3288%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Exception in thread "main" java.lang.IllegalStateException:

Saravanan
Hi Sonu, 

System.setProperty  line is commented, please uncomment and execute. 

Thanks

Saravanan

On Thu, 5 Jul 2018 at 02:36, Sonu Sharma <[hidden email]> wrote:
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
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.firefox.GeckoDriverService.access$000(GeckoDriverService.java:37)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:95)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:238)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127)
at pack.New.main(New.java:13)


I'm running simple code in eclipse and getting above error

package pack;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class New {

 public static void main(String[] args) {
  //set geckodriver path.
//System.setProperty("webdriver.gecko.driver","D:\\selenium\\geckodriver-v0.21.0-win64\\geckodriver.exe");
  //initialize firefox driver object to open firefox browser.
    WebDriver driver = new FirefoxDriver();
    //open URL in browser.
    driver.get("http://google.com/");
    String i = driver.getCurrentUrl();
    System.out.println(i);
    driver.close();
   }
}

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/774a7115-4f8c-4a66-b694-369beebb3288%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJ9UOtFOpSdnjt6%3DFbfhZu1JndDFT11qQJhivpjEuhJimoUnSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Exception in thread "main" java.lang.IllegalStateException:

total QA
Also its always a good practice to copy this executable in the project location.In that case we dont need set any path as below

System.setProperty("webdriver.gecko.driver","geckodriver.exe");

To explore more topics on selenium refer to these postings:




On Thursday, July 5, 2018 at 9:57:51 AM UTC+5:30, Saravanan wrote:
Hi Sonu, 

System.setProperty  line is commented, please uncomment and execute. 

Thanks

Saravanan

On Thu, 5 Jul 2018 at 02:36, Sonu Sharma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="xHG7xV8wAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sonu.lu...@...> wrote:
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see <a href="https://github.com/mozilla/geckodriver" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmozilla%2Fgeckodriver\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGS-Jw-ENYGAGzH38eboe42n3xcXA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmozilla%2Fgeckodriver\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGS-Jw-ENYGAGzH38eboe42n3xcXA&#39;;return true;">https://github.com/mozilla/geckodriver. The latest version can be downloaded from <a href="https://github.com/mozilla/geckodriver/releases" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmozilla%2Fgeckodriver%2Freleases\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFId2hfAooV5I0Sr5S20Swp5GRNug&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmozilla%2Fgeckodriver%2Freleases\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFId2hfAooV5I0Sr5S20Swp5GRNug&#39;;return true;">https://github.com/mozilla/geckodriver/releases
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.firefox.GeckoDriverService.access$000(GeckoDriverService.java:37)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:95)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:238)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127)
at pack.New.main(New.java:13)


I'm running simple code in eclipse and getting above error

package pack;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class New {

 public static void main(String[] args) {
  //set geckodriver path.
//System.setProperty("webdriver.gecko.driver","D:\\selenium\\geckodriver-v0.21.0-win64\\geckodriver.exe");
  //initialize firefox driver object to open firefox browser.
    WebDriver driver = new FirefoxDriver();
    //open URL in browser.
    driver.get("<a href="http://google.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://google.com/&#39;;return true;" onclick="this.href=&#39;http://google.com/&#39;;return true;">http://google.com/");
    String i = driver.getCurrentUrl();
    System.out.println(i);
    driver.close();
   }
}

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="xHG7xV8wAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="xHG7xV8wAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/774a7115-4f8c-4a66-b694-369beebb3288%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/774a7115-4f8c-4a66-b694-369beebb3288%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/774a7115-4f8c-4a66-b694-369beebb3288%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/774a7115-4f8c-4a66-b694-369beebb3288%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5db17e6b-8a55-4615-9e7f-0965267e2b12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.