0 votes
1 view
in Devops and Agile by (25k 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 (63.3k 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...