Unable to launch firefox browser | Selenium Forum
M
mallikarjuna Posted on 17/07/2019

Hi,

    Below is sample code i used to launch firefox browser.

Please help me out to resolve this issue.

 

package webpackage;
import org.openqa.selenium.firefox.FirefoxDriver;

public class First {

public static void main(String[] args) {

System.out.println("Hello browser launch test");

// declaration and instantiation of objects/variables
System.setProperty("webdriver.firefox.marionette","D:\\test\\testing\\Auto\\Browserdrivers\\firefox\\geckodriver-v0.23.0-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
//comment the above 2 lines and uncomment below 2 lines to use Chrome
//System.setProperty("webdriver.chrome.driver","G:\\chromedriver.exe");
//WebDriver driver = new ChromeDriver();

String baseUrl = "www.google.com";

// launch Fire fox and direct it to the Base URL
driver.get(baseUrl);
//close Fire fox
driver.close();
}
}

 

exception:

 

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
WebDriver cannot be resolved to a type
FirefoxDriver cannot be resolved to a type

at webpackage.First.main(First.java:12)

 

Below is test environment:

firefox 62

selenium 3.11

Windows7


A
Ashish Thakur Replied on 18/07/2019

Have you imported all the supplied jars that came with selenium?

If not, add all these jars and then try executing the code.

You need to add jars available in libs directory as well.


M
mallikarjuna Replied on 18/07/2019

Hi Team,

   Yes, i have used single standalone jar(selenium-server-standalone-3.11.0.jar). Is not equal to selenium-server-3.11.0.zip?

 


M
mallikarjuna Replied on 18/07/2019

I have added all jars from selenium-server-3.11.0.zip including lib folder jars. But still facing same issue. Please guide me. Below attaching screenshot for reference.

Responsive image

A
Ashish Thakur Replied on 19/07/2019

Please use jars from official resources. Additionally, make sure that you are not importing multiple jars for the same thing.


M
mallikarjuna Replied on 19/07/2019

I already taken jars from official site only and not imported multiple jars. Not able to understand on which reason it is not working for me.


A
Ashish Thakur Replied on 22/07/2019

Please use the jars availlable in the link below.

https://www.seleniumhq.org/download/

Additionally ping me on skype at abhishek@whizdomtraining.com if the issue still does'nt resolve after the newly added jars from the link provided.