0

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

DeadUnicorn
  • 175
  • 1
  • 12
  • 1
    Possible duplicate of [Python selenium webdriver "Session not created" exception when opening Chrome](https://stackoverflow.com/questions/40373801/python-selenium-webdriver-session-not-created-exception-when-opening-chrome) – Navarasu Oct 23 '18 at 22:27
  • No, it's not my case. Installed chomedriver is compatible with installed google chrome. – DeadUnicorn Oct 24 '18 at 09:59
  • Check wether your chrome driver is accessible? Try this steps and debug the issue https://stackoverflow.com/questions/52821461/selenium-chrome-browser-org-openqa-selenium-webdriverexception-timed-out-waitin/52824533#52824533 – Navarasu Oct 24 '18 at 10:44

2 Answers2

1

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.
PixelEinstein
  • 1,713
  • 1
  • 8
  • 17
  • Thanks for your answer. This code causes the same error. I'm using non-headless chrome (I tried it with headless and it doesn't work too). Chromedriver downgrading and reboot didn't help too( – DeadUnicorn Oct 24 '18 at 09:33
  • hmm there might be something happening with your ipv4, please try the commands from [THIS](https://stackoverflow.com/questions/48770943/selenium-chromedriver-session-not-created-unable-to-connect-to-renderer) answer. – PixelEinstein Oct 24 '18 at 15:27
0

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

DeadUnicorn
  • 175
  • 1
  • 12