BeginMoh
BeginMoh

Reputation: 123

Selenium 2: error: cannot parse capability: chromeOptions

Getting the following error when trying to run my tests with the ChromeDriver 2.9:

unknown error: cannot parse capability: chromeOptions org.openqa.selenium.WebDriverException: unknown error: cannot parse capability: chromeOptions from unknown error: must be a dictionary (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86) (WARNING: The server did not provide any stacktrace information)

Here is my code:

File file = new File("C:/Users/Desktop/TestSE/chromedriver.exe");
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());        
driver = new ChromeDriver();
baseUrl = "http://localhost:8080/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

I also run my selenuim server using the following command:

java -jar selenium-server-standalone-2.44.0.jar -Dwebdriver.chrome.driver=chromedriver.exe

my server is running correctly (I checked by thsi url: http://localhost:4444/selenium-server/driver/?cmd=getLogMessages and I have "OK" as message)

Upvotes: 4

Views: 8531

Answers (2)

Inaam Gharbi
Inaam Gharbi

Reputation: 1

System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver_win32 \\chromedriver.exe");
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--headless");
    driver = new ChromeDriver(chromeOptions);

Upvotes: 0

SahilPatel
SahilPatel

Reputation: 362

Try This Command to register node for Chrome

java -jar selenium-server-standalone-2.48.2.jar -role node -hub http://localhost:4444/grid/register -maxSession 15 -browser browserName="chrome",version=ANY,platform=ANY,maxInstances=15 -Dwebdriver.chrome.driver=/path/to/chromedriver

Hope this will help you

Upvotes: 1

Related Questions