Forums

chromedriver

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

To use Chrome, 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()

Thank 's it doesn't work for me with this error: urllib3.connection.HTTPConnection object at 0x7f303036c8b0>: Failed to establish a new connection: [Errno 111] Connection refused')

If you've left previous processes lying around, you'll probably have trouble creating a new one. Check the process list on your Consoles page (by clicking the "Fetch process list" button) for old copies of Chrome. Also, Chrome uses a lot of CPU just to start up, so if you're in the tarpit (or close to it), you may not be able to start Chrome.

This is causing the website I am scraping to throw a 403 response. However on testing my app locally using the traditional selenium method webdriver.Chrome() it does not?

I see that you upgraded your account today (thanks!). If you're still getting a 403 after you upgraded, then try running it in a new console -- old consoles might still have the old free account settings, so you'd be limited to accessing sites on our whitelist.

Thanks, great to finally use this service to check prices on some websites I am following!

I still have the same issue in a new bash console. When I run my Python script from my own terminal the normal way with 'webdriver.Chrome()' my code works, but even if I test using 'chrome_options = webdriver.ChromeOptions()...' doing it your suggested way in my own terminal it doesn't work?

Message: 
Stacktrace:
#0 0x558a2ea4fe89 <unknown>

What do you mean by "my own terminal"? Your local machine?

Yes, my local machine. I just ran a quick test there to see. Can't get Selenium to work on here with webdriver.ChromeOptions() or any argument options. The program does start and runs initially but then crashes. with that Stacktrace error in my last post.

It's impossible for us to debug code running on your local machine.

I simply commented that I had tested your selenium solution on my local machine and got the same error result.

Ok, so I managed to get it resolved for now if someone else has trouble:

options = webdriver.ChromeOptions()
options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_argument("--headless")
options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=options)