Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac + Selenium + Chrome = cannot find Chrome binary

Hi i m trying to setup selenium with eclipse on a Mac pc. When I download the ChromeDriver and place it on the below folder :

System.setProperty("webdriver.chrome.driver","/Users/george/Downloads/chromedriver");
WebDriver driver = new ChromeDriver();

I run the code. Then I get the following exception :

Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 33424 Only local connections are allowed. Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.10.5 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 312 milliseconds Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58' System info: host: 'Georges-Mac-mini.local', ip: '192.168.1.2', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.7.0_25' Driver info: org.openqa.selenium.chrome.ChromeDriver

So I m assuming that some binary is missing? Note that I use regularly Chrome as my browser.. I dont know if this is related or not. My pc is mac. I have read the ChromeDriver site but I dont understand what exactly to do. I have problems navigating to paths that are a bit strange like : "Google Drive" instead of "Google/Drive" or paths like "cd Chrome\ Apps.localized/" or "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome". I mean , wt?? are those back and forth slashes ??? I just now a few things on linux but here.. i m stuck and confused On Windows things where much easier.. you just downloaded an .exe file locally point the driver with options to that file and everything was smoothly. I cant find information on mac specific.

Can anyone help ?

Thanks

like image 228
user3172824 Avatar asked May 22 '16 06:05

user3172824


People also ask

Where is my Chrome binary located?

What is the exact path to the chrome binary on your PC? If you are working on Windows 10, it would be C:\Program Files (x86)\Google\Chrome\Application\chrome.exe .

How do I use Chromedriver binary?

To use chromedriver just import chromedriver_binary . This will add the executable to your PATH so it will be found. You can also get the absolute filename of the binary with chromedriver_binary. chromedriver_filename .

How do I find my Chromedriver on Mac?

If you face “Error: “chromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser“, you need to go to usr/local/bin folder and right-click chromeDriver file and open it. After this step, re-run your tests, chrome driver will work.


2 Answers

"cannot find Chrome binary" simply means the os cannot find chrome app. Just check chrome installation directory. Right directory should be "/Applications/Google Chrome.app". If you download your chrome from third platform, the directory may be "/Applications/Chrome.app". It makes the os cannot find your chrome.

like image 135
Lytous Zhang Avatar answered Oct 01 '22 23:10

Lytous Zhang


The stack trace indicates that it cannot find the binary for the chrome webdrive. You'll need to download it if you haven't already. Once you have downloaded the chrome webdriver, point your application at the binary.

if you have a path with spaces, such as

/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

you'll need to escape the spaces with backslashes like so

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

a backslash followed by a space, \, tells the argument parser not to use that space as a delimiter but rather to include it as part of the path.

like image 39
Ben Glasser Avatar answered Oct 01 '22 22:10

Ben Glasser