Unable to find a matching set of capabilities with selenium 3.8.1 and gecko driver 0.19.0

33,258

Solution 1

new FirefoxDriver(DesiredCapabilities caps); 

is deprecated, use

FirefoxOptions options = new FirefoxOptions();
options.setCapability("marionette", false);
WebDriver webDriver = new FirefoxDriver(options);

and you are good to go

Solution 2

Another possible cause is the outdated Firefox version.

I upgraded the version and it works fine!

I could open the browser only setting options.setCapability("marionette", true);, then in the open window I upgraded through the "About Firefox" dialog. Then you have to remove the line about marionette.

Probably the one I had was only going to work with marionette while we are trying to use it with geckodriver, which has a different protocol. Anyone who knows more than me can confirm or deny!

Share:
33,258
shivam
Author by

shivam

Updated on April 27, 2020

Comments

  • shivam
    shivam about 4 years
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    //import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    
    public class Webdriver {
    
        public static void main(String[] args) throws InterruptedException {
            // TODO Auto-generated method stub
    
    
            System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\geckodriver.exe");
            WebDriver driver = new FirefoxDriver();
            //System.setProperty("webdriver.chrome.driver","C:\\Selenium\\chromedriver.exe");
            //WebDriver driver = new ChromeDriver();
    
            driver.get("https://maps.mapmyindia.com");
    
            Thread.sleep(2000);
            driver.findElement(By.id("auto")).sendKeys("TCS");
    
            Thread.sleep(2000);
            driver.findElement(By.id("auto_geo")).click();
    

    When i run this code on eclipse luna there is an error: Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities