Forums

Chromedriver via Selenium?

Hi! Could you please enable Selenium Chromedriver for my account? Thank you!

It's enabled for all accounts now; however, as you're on our older "fishnchips" system image, 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()

Thanks giles. Follow up question: often with my always on tasks when checking the logs, there is way less output than I expect. Especially with periodic prints, but with my latest task even with the logs that are printed when the script is first started. Is this normal?

Are you flushing the output in your prints? Python buffers output to files (like always-on task logs) so you might get the effect you want by adding flush=True to your print statements, like this:

print("something", flush=True)

Thanks giles. That worked.

Thanks for confirming that!