Forums

How can I get chromedriver to work on my python script (for daily task)?

When I run my script in Pycharm, it works perfectly, but when I run it in the daily tasks of pythonanywhere, I get a chromedriver error.

We've enabled you virtualization feature which is needed for that.

You'll need to upgrade Selenium for your account -- for example, if you're using Python 3.7, run this in Bash:

pip3.7 install --user --upgrade selenium

...and then you can run Selenium with Chrome using code like this:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)

try:
    browser.get("https://www.google.com")
    print("Page title was '{}'".format(browser.title))

finally:
    browser.quit()