Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot open Chrome
#1
from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://www.google.com/")
When execute this script via CMD. It showed me this error message.

Capture
Reply
#2
The simplest solution is to have chromedriver.exe is same folder as you run script.
When it complain a about PAth,it mean Environment Variables Path.
Example so i C:\cmder\bin\ added to Windows Path.
More in tutorial here Web-scraping part-2.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time

#--| Setup uncomment for headless
chrome_options = Options()
#chrome_options.add_argument("--headless")
#chrome_options.add_argument('--disable-gpu')
#chrome_options.add_argument('--log-level=3')
browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe')
#--| Parse or automation
browser.get('https://duckduckgo.com')
input_field = browser.find_elements_by_css_selector('#search_form_input_homepage')
input_field[0].send_keys('car' + Keys.RETURN)
time.sleep(3)
images_link = browser.find_elements_by_link_text('Bilder') # Or contry name of Images
images_link[0].click()
time.sleep(5)
browser.quit()
Reply
#3
(Jan-25-2019, 05:30 PM)snippsat Wrote: The simplest solution is to have chromedriver.exe is same folder as you run script.
When it complain a about PAth,it mean Environment Variables Path.
Example so i C:\cmder\bin\ added to Windows Path.
More in tutorial here Web-scraping part-2.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import time

#--| Setup uncomment for headless
chrome_options = Options()
#chrome_options.add_argument("--headless")
#chrome_options.add_argument('--disable-gpu')
#chrome_options.add_argument('--log-level=3')
browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe')
#--| Parse or automation
browser.get('https://duckduckgo.com')
input_field = browser.find_elements_by_css_selector('#search_form_input_homepage')
input_field[0].send_keys('car' + Keys.RETURN)
time.sleep(3)
images_link = browser.find_elements_by_link_text('Bilder') # Or contry name of Images
images_link[0].click()
time.sleep(5)
browser.quit()

Yes. When I install Python 3.7.2, I did click the PATH setting.
But somehow, I watch other people tutorials they just use .Chrome() instead?
Reply
#4
(Jan-26-2019, 04:06 AM)gahhon Wrote: Yes. When I install Python 3.7.2, I did click the PATH setting.
That was not what meant,but you can put chromedriver.exe in python 3.7 folder as it's in Windows Path.
But you have chosen the annoying long default path and not eg C:\Python37.
Python 3.6/3.7 and pip installation under Windows.
(Jan-26-2019, 04:06 AM)gahhon Wrote: But somehow, I watch other people tutorials they just use .Chrome() instead?
Yes it did work like that before,but after update executable_path= is required or as mention chromedriver.exe is same folder as script.
So if you use python 3.7 folder eg browser = webdriver.Chrome(executable_path=r'path_of_37_folder.chromedriver.exe.')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I get rid of "Chrome is being controlled by automated test software"? jetBlack 2 12,553 Jul-21-2022, 08:31 AM
Last Post: Benjamin112
  Expose chrome extension buttons to Python robertjaxe 2 2,313 May-12-2020, 07:52 PM
Last Post: robertjaxe
  Selenium/chrome console WiPi 4 5,826 Apr-12-2020, 11:45 AM
Last Post: WiPi
  Chrome instead of IE Friend 1 2,123 Feb-09-2020, 07:31 AM
Last Post: Larz60+
  Headless Chrome: How to login into a webpage? amandacstr 1 4,233 Feb-06-2020, 02:19 AM
Last Post: metulburr
  Interfacing Google Chrome & Python akornrumpf 5 3,995 Mar-16-2019, 10:20 PM
Last Post: Larz60+
  selenium - chrome crashes when chrome is running. RvBVakama 4 15,187 Dec-16-2018, 06:32 PM
Last Post: metulburr
  Alternatives to Chrome WebDriver? chisox721 4 7,095 Apr-23-2018, 06:24 PM
Last Post: chisox721
  Selenium chrome driver not returning solution Prince_Bhatia 0 3,532 Jul-06-2017, 06:40 AM
Last Post: Prince_Bhatia

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020