0

I am using selenium pyhthon to try and open amazon.com in google chrome, but I keep getting this error message when I run the code.

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

I have tried to search up this error on stackoverflow, but all I can find is Selenium gives "selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary" on Mac, which I cannot understand. I am using mac M1 and I have the chrome version 92.0.4515.107. My code is

from selenium import webdriver

chrome_driver_path = "/Users/asznee/selenium/chromedriver"
driver = webdriver.Chrome(chrome_driver_path)

driver.get("https://www.amazon.com")
5
  • Where is your Google Chrome installed , in which directory ? Commented Jul 24, 2021 at 7:02
  • 1
    this may help: stackoverflow.com/questions/64459351/chrome-driver-selenium/… please check the location of your chromedriver Commented Jul 24, 2021 at 7:03
  • My google chrome is /User/asznee/Desktop/Downloads/Google Chrome Commented Jul 24, 2021 at 7:10
  • And my chrome driver is in /User/asznee/selenium/chromedriver Commented Jul 24, 2021 at 7:12
  • selenium.common.exceptions.WebDriverException: Message: unknown error: no chrome binary at /User/asznee/Desktop/Downloads/Google Chrome. This is the error once I put 'options.binary_location = "/User/asznee/Desktop/Downloads/Google Chrome"' as the chrome_options Commented Jul 24, 2021 at 7:16

3 Answers 3

0

See your Google chrome is not installed in default location which is

C:\Program Files\Google\Chrome\Application

it is installed :

C:\Users\asznee\Desktop\Downloads\Google Chrome\Application 

right ?

so for solving this issue, your chromdriver.exe needs to know where Google chrome is installed :-

You can try the below code :-

options = webdriver.ChromeOptions()
options.binary_location = "/Users/asznee/Desktop/Downloads/Google Chrome/Application/chrome"
chrome_driver_binary = "/Users/asznee/selenium/chromedriver"
driver = webdriver.Chrome(chrome_driver_binary, options = options)
Sign up to request clarification or add additional context in comments.

4 Comments

It just gives this error selenium.common.exceptions.WebDriverException: Message: unknown error: no chrome binary at /Users/asznee/Desktop/Downloads/Google Chrome/Application/chrome
I am using windows so I have that application folder, Do you happen to have the same structure ? You can change it that to the location of your Google chrome installed directory and try again
My structure is just /Users/asznee/Desktop/Downloads
Do you see Chrome launcher in Downloads ? Are you sure if there isn't folder ?
0

there is no need to specify the path of the chrome driver just keep the chrome driver in the project just copy and paste in the project

and start initializing the web driver simply start typing with WebDriver driver = new ChromeDriver(); and enter the URL of the application and follow the code

1 Comment

What is the chrome driver?
0

WebDriver driver = new ChromeDriver();

WebDriver is having unimplemented methods

here is chrome driver is implementing these unimplemented methods

chrome driver is just the driver which you're telling the selenium to run the test on the chrome browser. you can download it on the

https://chromedriver.chromium.org/home

if you want to work with the firefox browser you use the gecko driver.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.