Unable to find Matching Set of Capabilities and ChromeDriver - java

Here is the situation. I downloaded the chrome webdriver, unzipped the file, and went through the steps for setting the path through system properties. I am still unable to open chrome from Eclipse. Please help.
Unable to find matching set of capabilities

You are giving wrong parameter in system properties
Gecko driver is for firefox
If you have already downloaded chrome driver simply replace geckodriver.exe with chromedriver.exe.Otherwise, Download chrome driver and place it in your folder given in system properties and run your code.
Your code will appear as:
System.setProperty("webdriver.chrome.driver", "C:\\Users\\...\\Drivers\\chromedriver.exe");
// **Note**: complete your path above
driver = new ChromeDriver();

Related

Java Selenium ChromeDriver executable does not exist

I looked everywhere and I don't know what am I doing wrong here. It would be really helpful if you could guys help me out.
Code:
System.setProperty("webdriver.chrome.driver","/Users/eshanmostafa/eclipse-
workspace/TestNG/chromedriver");
WebDriver driver = new ChromeDriver();
driver.manage().window().fullscreen();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(40,TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(40,TimeUnit.SECONDS);
}
Error Message:
FAILED CONFIGURATION: #BeforeMethod setUp
java.lang.IllegalStateException: The driver executable does not exist: /Users/eshanmostafa/eclipse-workspace/TestNG/chromedriver
at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
at
Are you using macbook? you need to change driver exe file as executable file then refresh project and try again

Selenium webdriver is looking at wrong path for Chrome.exe

I am trying to launch chrome.exe from selenium webdriver i have chrome installed on my machine and chromedriver path is also given in code but selenium webdriver for java is looking for chrome.exe on wrong path and giving error and not launching browser.
I have tried options class to locate the chrome.exe with the actual path of chrome.exe but not working for me.I have done required imports as well but still no success.
I have tried below selenium webdriver java code
public class News24Test
{
public static void main(String[] args) throws Exception
{
System.setProperty("webdriver.chrome.driver","C://News24SA//ChromeDriver//chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("C://Program Files(x86)//Google//Chrome//Application//chrome.exe"); // Provide absolute executable chrome browser path with name and extension here
WebDriver driver = new ChromeDriver(options);
driver.manage().window().maximize();
driver.get("http://www.news24.com");
}
}
Selenium is looking at below path which is wrong path
C:\Users\orestip\LocalSettings\Application Data\Google\Chrome\Application\chrome.exe
Try setting the options first:
ChromeOptions options = new ChromeOptions();
options.setBinary("C:\\Program Files(x86)\\Google\\Chrome\\Application\\chrome.exe");
System.setProperty("webdriver.chrome.driver","C:\\News24SA\\ChromeDriver\\chromedriver.exe");
WebDriver driver = new ChromeDriver(options);
Make sure the chromedriver version and the chrome browers versions match.
You can either update your chrome browser to match the driver version or you can choose a chromedriver that matches your browser version.
Hi so old question but if anyone else is a bit stumped by this, I'll give my take.
So, you may one day have a working chromedriver and then it suddenly just stops working. What actually happens is Chrome updates behind the scenes and makes it out of date.
What you need to do is update your chromedriver so it matches your actual, normal Chrome installation.

java.lang.IllegalStateException: The driver executable does not exist: C:\Users\jagrelot\workspace\AntBuildExample\chromedriver.exe with ChromeDriver

When I try to run Selenium within Eclipse, I get a The driver executable does not exist: error. I've ensured that the path to the exe is correct and that the environment PATH variable is set. The error is referencing an older location of the driver which was located in the workspace of the Java project. It seems to be working when I run it through the command line. Are there any suggestions to get the code to run in Eclipse properly?
public WebDriver chromeDriver;
#BeforeTest
public void beforeTestsetUp(){
System.setProperty("webdriver.chrome.driver", "C:\\Driver\\chromedriver.exe");
chromeDriver = new ChromeDriver();
[RemoteTestNG] detected TestNG version 6.12.0
FAILED CONFIGURATION: #BeforeTest beforeTestsetUp
java.lang.IllegalStateException: The driver executable does not exist: C:\Users\jagrelot\workspace\AntBuildExample\chromedriver.exe
The code block you have provided is not sufficient to analyze the root cause. How ever the following points are pretty much evident :
The initialization of ChromeDriver is error prone, it should have been :
ChromeDriver driver = new ChromeDriver();
As per best practices we should use the WebDriver interface instead of the ChromeDriver implementation :
WebDriver driver = new ChromeDriver();
As you are seeing the error as IllegalStateException: The driver executable does not exist: C:\Users\jagrelot\workspace\AntBuildExample\chromedriver.exe which clearly indicates your script is looking for the chromedriver binary in a different location other than the mentioned one. Probably its due to error prone code of setProperty.

IE Browser using Selenium Webdriver: "The driver executable is a directory"

I am getting the following error while trying to launch an IE browser using Selenium Webdriver. What seems to be the problem?
Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: D:\Bhavesh\Bhavesh_Data\Study\Selenium\IEDriverServer_x64_2.45.0
at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:119)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112)
at org.openqa.selenium.ie.InternetExplorerDriverService.access$1(InternetExplorerDriverService.java:1)
at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.build(InternetExplorerDriverService.java:247)
at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:251)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:146)
at first.IEDriver.main(IEDriver.java:11)
As per my understanding, when you set property for IEDriver location, you did not mentioned the full path (full directory path including iedriver exe)
For example.. Consider the following..
if you placed your IEDriverServer.exe in "D:/IEdriver" , then you have to set the property as follows:-
Right Approach:- System.setProperty("webdriver.ie.driver", "D:/IEdriver/IEDriverServer.exe");
Wrong approach :- System.setProperty("webdriver.ie.driver", "D:/IEdriver");
Let me know if it helps
I think there might be an issue in setting up the executable property..
Set the executable property as below
File file = new File("C:/Seleniumjars/IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
driver = new InternetExplorerDriver();
}
Check path to driver, click on driver by right button in IDE and copy path to folder
Try to change path to something like this (with backslashes):
System.setProperty("webdriver.chrome.driver",
new File("C:\\QA\\neoAutomation\\src\\main\\resources\\drivers\\chromedriver.exe")
.getAbsolutePath());
return new ChromeDriver(getCapabilities(browser));
Add one folder and add all the drivers needed.
Now copy the path of the driver from properties and use it in set property example.
System.setProperty("webdriver.chrome.driver","C:\\Users\\arumugam\\eclipse-workspace\\FirstTestNG\\driversdirector\\chromedriver.exe");

How to run selenium tests in Chrome browser?

I have some tests using JUnit and Selenium, and I need to run it on the Chrome browser. I downloaded the Chrome driver, and configure my SetUp() as:
#Before
public void SetUp() throws Exception{
System.setProperty("webdriver.chrome.driver","");
driver = new ChromeDriver();
baseUrl = ;
driver.get(baseUrl);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);//Wait 5 seconds to load the page
}
The ChromeDriver.exe are added in my "Referenced Libraries" folder.
When I'll run the tests, the following error is displayed:
java.lang.exception: No runnable methods
Anybody know how can I fix this?
SOLUTION
1º Add the chromedriver in the path of your computer.
2º Update your setProperty as: System.setProperty("webdriver.chrome.driver","C:\\Users\\pedro_nazario\\Desktop\\ChromeDriver\\chromedriver.exe");
The second parameter must be the way where is your Chromedriver.exe in my case, the chromedriver are in a folder on desktop.
The most important thing, that you never forget
When you'll run the tests, before, close your Chrome browser completely. Any chrome browser must be open before you run your tests. If have some chrome browser opened, the selenium will take a error in your screen.
According to the documentation, webdriver.chrome.driver should contain the path to the chromedriver executable:
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
Alternatively, you can add path to the chromedriver to the PATH environment variable.

Categories