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.

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.
chromedriver.exe
is same folder as you run script.C:\cmder\bin\
added to Windows Path.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-25-2019, 05:30 PM)snippsat Wrote: [ -> ]The simplest solution is to havechromedriver.exe
is same folder as you run script.
When it complain a about PAth,it mean Environment Variables Path.
Example so iC:\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)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.C:\Python37
.(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.browser = webdriver.Chrome(executable_path=r'path_of_37_folder.chromedriver.exe.')