DeadUnicorn
DeadUnicorn

Reputation: 185

Running chrome via selenium

I did it earlier but I can't use chrome via selenium now. Browser opens for a few seconds then closes and then I got an error (about 5 minutes later):

 Message: session not created
from disconnected: unable to connect to renderer
(Session info: chrome=70.0.3538.67)
(Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 4.18.14-arch1-1-ARCH x86_64)

I use following code for running browser (which I always use):

from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
opts = Options()
browser = Chrome(options=opts)

Chromedriver directory is in the PATH. Versions of chrome and chromedriver you can see in the error. Python 3.7.0, selenium==3.14.0. What's wrong in my actions?

P.S. BTW, It works fine with Firefox

Upvotes: 0

Views: 812

Answers (2)

DeadUnicorn
DeadUnicorn

Reputation: 185

Actually I don't know why, but it works fine now. Everything I did are recommendations from the answer above. It didn't work right after my actions but now it's okay

Upvotes: 0

PixelEinstein
PixelEinstein

Reputation: 1733

Your versions look compatible with each other based on the compatibility list, so I don't think it has to do with that. I have not seen those options used in that way before though.

Please try this:

from selenium import webdriver

ChromeOptions = webdriver.ChromeOptions()
browser = webdriver.Chrome(chrome_options=ChromeOptions)
browser.get("https://www.google.com")
browser.quit()

Let me know if that is able to open your browser. If it is, then I am assuming you are having issues with some of the options you are passing chrome.

If you are still have issues after checking all the options you are passing chrome, try rolling back your chromedriver version HERE to 2.42. It should still be compatible with chromer version 70.-.

I am on the same versions as you, and I'm not experiencing this issue.

A couple other things to think about:

  • Are you using headless chrome? If so switch to non-headless and test.
  • Make sure to close out of all instances of chromedriver before updating with another version.
  • If chrome recently updated, or you recently updated your driver, try restarting the machine.

Upvotes: 1

Related Questions