I am trying to run the below code but java lang Illegalstate Exception is coming

0 votes
package org.selenium.sample;

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

public class demo {

 public static void main(String[] args) {
  // TODO Auto-generated method stub

  WebDriver x=new FirefoxDriver();

Jun 21, 2019 in Selenium by anonymous

2 answers to this question.

0 votes
Best answer

You are facing this error because while initializing firefox driver, you have used wrong keyword for setting Property i.e. instead of using:




webdriver.gecko.driver is the correct keyword for firefox driver. Now java is case-sensitive, so using Webdriver.gecko.driver, it will throw an error.

Hope this would help.

answered Jun 21, 2019 by Abha
• 28,060 points
0 votes
Thank you so much for answering.I have been struggling from past 3 days.
answered Jun 21, 2019 by anonymous
Your most welcome. Please feel free to ask any other questions you have.

Related Questions In Selenium

0 votes
0 answers
0 votes
0 answers
0 votes
0 answers

I am getting no such alert exception in selenium when i tried to run the script

I am getting error after executing the ...READ MORE

Feb 3, 2020 in Selenium by puneeth
• 120 points
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,520 points
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,050 points
0 votes
2 answers

What is the role of TestNG & JUnit frameworks in Selenium?

TestNG and JUnit are test frameworks . it ...READ MORE

answered Sep 4, 2020 in Selenium by Sri
• 3,050 points
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points