-2

I am getting:

"Exception in thread "main" java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from FirefoxDriver to WebDriver" error in the console

I have added jars files correctly..but still facing issue..please help enter image description here

package demo;

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

public class TestFacebookRegistration {

public static void main(String[] args) {

    WebDriver driver= new FirefoxDriver();

    driver.get("https://www.facebook.com");

    driver.manage().window().maximize();
    }

}
6
  • 1
    You need to post your code, please.
    – Brian
    Commented Feb 13, 2019 at 18:02
  • I have added the code
    – Albin K S
    Commented Feb 14, 2019 at 1:16
  • I meant post the code, NOT a screenshot of it 😀
    – Brian
    Commented Feb 14, 2019 at 1:30
  • 1
    Also, look at your imports; they are not resolving. Do you have the proper references in your project?
    – Brian
    Commented Feb 14, 2019 at 1:34
  • sorry...updated
    – Albin K S
    Commented Feb 14, 2019 at 1:34

2 Answers 2

2

For using FirefoxDriver, you now have to use Geckodriver's

public static void main(String[] args) {
// declaration and instantiation of objects/variables
System.setProperty("webdriver.firefox.marionette","C:\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();    
}

You can read more about it here

4
  • but I have already set the system properties for Geckodriver in the system settings
    – Albin K S
    Commented Feb 14, 2019 at 1:44
  • Can you please share the full code. Also like Brian mentioned you have code import resolve issues. Is it resolved now? Commented Feb 14, 2019 at 2:37
  • No.when I try to resolve the errors with imports, it shows like " Package org.openqa.selenium.firefox is accessible from more than one moduleclient.cmbined,okio in the popup when mouse hovering above the import statements
    – Albin K S
    Commented Feb 14, 2019 at 2:41
  • Can you check this link, exact same issue you are mentioning. link Commented Feb 14, 2019 at 3:36
0

There is a issue in your package, I think you missed one of them. I suggest you to use the pom so that it install all of thel automatically. By the way, the webdriver for Firefoix is geckodriver, not marionnette.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.