I got the following code on PythonAnywhere:
from selenium import webdriver
import os
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
chrome_driver = os.path.abspath('C:/Users/ross/Desktop/chromedriver.exe')
browser = webdriver.Chrome(chrome_driver)
browser.get("https://www.google.com/")
WebDriverWait(browser,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "body > div.L3eUgb > div.o3j99.ikrT4e.om7nvf > form > div:nth-child(1) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input"))).send_keys("directions 3406 north seminary ave to 933 robinhood lane")
WebDriverWait(browser,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "body > div.L3eUgb > div.o3j99.ikrT4e.om7nvf > form > div:nth-child(1) > div.A8SBwf > div.FPdoLc.lJ9FBc > center > input.gNO89b"))).click()
value = WebDriverWait(browser,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"#exp0 > div.mGSxre.Ra9ql > div > div"))).text
print(value)
I am referencing the absolute path and the code will work when I run it on PyCharm. I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/rossleavitt/C:/Users/ross/Desktop/chromedriver.exe'
While Handling that error I get
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
What's happening here? Do I need to upgrade my account?
Ross