Zohaib Shamshad
Zohaib Shamshad

Reputation: 151

Could not get version for Chrome with this command: google-chrome --version || google-chrome-stable --version

Web scraping with selenium works fine on my mac local machine but when I push to live Ubuntu server, I get the following error

Could not get version for Chrome with this command: google-chrome --version || google-chrome-stable --version

when I try to run

from webdriver_manager.chrome import ChromeDriverManager

chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)

The code is deployed on AWS ec2 instance

Upvotes: 3

Views: 11331

Answers (4)

gore
gore

Reputation: 571

Possible: you don't have GoogleChrome or your OS doesn't know about it. I suggest that you use Chromium browser.

The solution if you want to download Chromium webdriver by webdriver-manager:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType

webdriver.Chrome(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()

Upvotes: 4

Zohaib Shamshad
Zohaib Shamshad

Reputation: 151

As stated by @gore in the comments installing chromium-chromedriver on ubuntu server worked for me

On Ubuntu 20.04

pip install selenium
sudo apt-get update
sudo apt install chromium-chromedriver

Upvotes: 2

Alexandru Placinta
Alexandru Placinta

Reputation: 679

If you are using Chromium, try installing Google Chrome instead of using chromium. As far as I know selenium is designed for Chrome. There is another related topic here: Making program using Chromedriver, getting error: "Could not get version for Chrome with this command"

Upvotes: 0

Vadim
Vadim

Reputation: 1

try it like this

options = webdriver.ChromeOptions()

here's another hint for you http://chromedriver.chromium.org/capabilities

Upvotes: -3

Related Questions