1

I am having this error apparently when trying to access a url that the script requests, does not have a specific. I don't understand exactly why this error, but I want to treat it so as not to abort the script when it occurs.

code:

from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--incognito')
chrome_options.add_argument('--headless')
driver = webdriver.Chrome("/driver/chromedriver", options=chrome_options)

Error:

Traceback (most recent call last):
  File "scripts/page11.py", line 15, in <module>
    driver = webdriver.Chrome(BASE_WEB_DRIVER, options=chrome_options)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from tab crashed
  (Session info: headless chrome=78.0.3904.108)
JB_
  • 533
  • 1
  • 6
  • 18
  • Check whether browser versions is compatible with your chrome driver versions. Check the link https://chromedriver.chromium.org/downloads – KunduK Nov 27 '19 at 12:25
  • Chrome: `Google Chrome 78.0.3904.108` and driver: `ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877})` are compatible. – JB_ Nov 27 '19 at 12:29
  • Yes that's correct.So using this you are still getting the error `session not created` – KunduK Nov 27 '19 at 12:42
  • yes, this error in message. – JB_ Nov 27 '19 at 12:56
  • Is interactive mode working?Not headless. – KunduK Nov 27 '19 at 13:18
  • I have run several scripts using seleniun, which will open url and collecting information at some point when accessing a url he gives this error, I am not using interactive mode. – JB_ Nov 27 '19 at 13:23

0 Answers0