IllegalStateException

95 views
Skip to first unread message

priya

unread,
May 11, 2018, 1:31:53 AM5/11/18
to Selenium Users
Hi All,
 
I'm new to selenium ,
I'm using selenium 3.140
fire fox driver-geckodriver-v0.20.1-win32
chrome driver - chromedriver_win32
java 8

my code
System.setProperty("webdriver.gecko.driver","C:\\Users\\geckodriver-v0.20.1-win32\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("http://www.google.com");

after running this code , I still see IllegalStateException error.
Please suggest ..

sravya pudota

unread,
May 11, 2018, 1:38:19 AM5/11/18
to seleniu...@googlegroups.com
Hi,

Try this-

System.setProperty("webdriver.gecko.driver", " C:\\Users\\geckodriver-v0.20.1-win32\\geckodriver.exe ");
FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability("marionette", true);
  WebDriver  driver = new FirefoxDriver(firefoxOptions);

--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5613fc33-08e9-42f8-8b9c-b9d557ed1949%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

priya

unread,
May 11, 2018, 1:54:04 AM5/11/18
to Selenium Users
Thanks for the reply ,

I still see Exception

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\lavanya\eclipse-workspace\MyProjects\"C:\Users\lavanya\Downloads\drivers\geckodriver-v0.20.1-win32\geckodriver.exe"
at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:136)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:131)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:42)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:143)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:335)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:168)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at FireFox.main(FireFox.java:14)

On Friday, May 11, 2018 at 11:08:19 AM UTC+5:30, sravya pudota wrote:
Hi,

Try this-

System.setProperty("webdriver.gecko.driver", " C:\\Users\\geckodriver-v0.20.1-win32\\geckodriver.exe ");
FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability("marionette", true);
  WebDriver  driver = new FirefoxDriver(firefoxOptions);
On Fri, May 11, 2018 at 10:49 AM, priya <marella...@gmail.com> wrote:
Hi All,
 
I'm new to selenium ,
I'm using selenium 3.140
fire fox driver-geckodriver-v0.20.1-win32
chrome driver - chromedriver_win32
java 8

my code
System.setProperty("webdriver.gecko.driver","C:\\Users\\geckodriver-v0.20.1-win32\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("http://www.google.com");

after running this code , I still see IllegalStateException error.
Please suggest ..

--
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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

NaveenKumar Reddy R

unread,
May 11, 2018, 2:02:47 AM5/11/18
to seleniu...@googlegroups.com
Change the below line


System.setProperty("webdriver.gecko.driver", " C:\\Users\\lavanya\\Downloads\\drivers\\geckodriver-v0.20.1-win32\\geckodriver.exe"



Thanks
 

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/508b5dd7-b81d-4ce6-945c-1969f1bf6b23%40googlegroups.com.

priya

unread,
May 11, 2018, 2:07:25 AM5/11/18
to Selenium Users
I did , No luck :(

priya

unread,
May 11, 2018, 2:15:25 AM5/11/18
to Selenium Users
Please help ! I.m stuck with this ...

sravya pudota

unread,
May 11, 2018, 2:19:33 AM5/11/18
to seleniu...@googlegroups.com
Check once , are you able to access the driver location or not. Showing error " The driver executable does not exist"

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8c2f6039-faf6-4bb3-aab2-0f6044206a27%40googlegroups.com.

Pradeep kumar

unread,
May 11, 2018, 2:27:38 AM5/11/18
to seleniu...@googlegroups.com
Which firefox version you are using ??

Can you try samething in chrome and check whether its working or not?

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c084c601-3b7f-41d1-96dc-ddcd28957900%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Regards,
Pradeep
9611346848

Yogesh Khachane

unread,
May 11, 2018, 2:40:50 AM5/11/18
to seleniu...@googlegroups.com
hi priya,
use latest firefox version and gackodriver version as well as latest selenium version and set implicit wait 20 second after creating driver instance it will definitely work.
If any query let me know.

  




--
Regards,
Pradeep
9611346848

--
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 selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
With Best Regards,
Yogesh  Khachane
Framework Developer
+91-9922455800

priya

unread,
May 11, 2018, 2:53:53 AM5/11/18
to Selenium Users
It worked , It worked !!!! 
Thanks guys , Thanks a lot :)

Worked well with latest versions in chrome and Firefox and Thread.sleep(3000L)

Thanks again :)



--
Regards,
Pradeep
9611346848

--
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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Yogesh Khachane

unread,
May 11, 2018, 3:12:22 AM5/11/18
to seleniu...@googlegroups.com
Hi Priya,

don't use  Thread.sleep(3000L) at the time of driver instantiation, you should use implicit wait and  pageLoadTimeout.

If you use below web environment setup the you generally never get initilization exception. 

you can use below generic method.


public WebDriver initializeWebEnvironment(Properties objConfig)
{
try 
{
String browser =  objConfig.getProperty("web.browser").trim().toLowerCase();

switch (browser)
{
case "ie": // If specified browser is Internet Explorer
System.setProperty("webdriver.ie.driver",System.getProperty("user.dir") + objConfig.getProperty("webdriver.ie.driver").trim());
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "IE");
capabilities.setCapability(CapabilityType.VERSION, "11");
capabilities.setCapability("requireWindowFocus", true);  
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, false);
capabilities.setCapability("ie.ensureCleanSession", true);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
webDriver = new InternetExplorerDriver(capabilities);
// webDriver = new InternetExplorerDriver();
break;

case "firefox": // If specified browser is Firefox 
System.setProperty("webdriver.gecko.driver",System.getProperty("user.dir") + objConfig.getProperty("webdriver.gecko.driver").trim());
// System.setProperty("webdriver.firefox.marionette",System.getProperty("user.dir") + objConfig.getProperty("webdriver.gecko.driver").trim());
webDriver = new FirefoxDriver();
break;

case "chrome": // If specified browser is Chrome 
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + objConfig.getProperty("webdriver.chrome.driver").trim());
String downloadFilepath =System.getProperty("user.dir")+objConfig.getProperty("downloads.path").trim();
                 HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
     chromePrefs.put("download.default_directory", downloadFilepath);
     ChromeOptions options = new ChromeOptions();
     options.setExperimentalOption("prefs", chromePrefs);    
     DesiredCapabilities cap = DesiredCapabilities.chrome();    
     cap.setCapability(ChromeOptions.CAPABILITY, options);
webDriver = new ChromeDriver(cap);
break;

default:
webDriver = new FirefoxDriver();
}
// Set the minimum width and height to ensure there is no unintentional overlap of UI elements
webDriver.manage().window().maximize();
// Wait for ui-elements to potentially load, up to a second.
webDriver.manage().timeouts().implicitlyWait(Integer.parseInt(objConfig.getProperty("driver.implicitlyWait").trim()), TimeUnit.SECONDS);
// limit how much time a driver should wait for a page to load
webDriver.manage().timeouts().pageLoadTimeout(Integer.parseInt(objConfig.getProperty("driver.pageLoadTimeout").trim()), TimeUnit.SECONDS);

return webDriver;
}
catch (Exception exception) 
{
exception.printStackTrace();

return null;
}
}

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9752d85a-1ee6-4034-ab8a-2730abcae0f4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
With Best Regards,
Yogesh  Khachane
Framework Developer

priya

unread,
May 11, 2018, 4:25:19 AM5/11/18
to Selenium Users
OKay ! Many Thanks for the information ...

kamraan syed

unread,
Jul 4, 2018, 5:07:22 PM7/4/18
to Selenium Users
Hi, 
How do i post a new request for help as I am getting Selenium Java webdriver error when using geckodriver?

I'm using latest Firefox 61.0,
Selenium 3.12.0
Windows 10 64-bit
geckodriver 0.21.0


Thanks in advance
Kamraan
Reply all
Reply to author
Forward
0 new messages