Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

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://ww.google.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

1 Answer

0 votes
by (62.9k points)

Since the below statement is abhorred:

new FirefoxDriver(DesiredCapabilities caps);

You can use the below-stated statement:

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

WebDriver webDriver = new FirefoxDriver(options);

and you should be able to run your code without errors.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium online courses!

Browse Categories

...