Jan-25-2019, 04:19 PM
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.

Cannot open Chrome
|
Jan-25-2019, 04:19 PM
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. ![]()
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()
Jan-26-2019, 04:06 AM
(Jan-25-2019, 05:30 PM)snippsat Wrote: The simplest solution is to have 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?
Jan-26-2019, 04:56 AM
(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.')
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Selenium/chrome console | WiPi | 4 | 7,177 |
Apr-12-2020, 11:45 AM Last Post: WiPi |
|
Chrome instead of IE | Friend | 1 | 2,749 |
Feb-09-2020, 07:31 AM Last Post: Larz60+ |
|
selenium - chrome crashes when chrome is running. | RvBVakama | 4 | 17,412 |
Dec-16-2018, 06:32 PM Last Post: metulburr |
|
Alternatives to Chrome WebDriver? | chisox721 | 4 | 9,057 |
Apr-23-2018, 06:24 PM Last Post: chisox721 |