1

I am trying to do scraping using Selenium. I have downloaded ChromeDriver 83.0.4103.39 and I have the latest Chrome Browser (chrome=83.0.4103.106).

When I do :

driver = webdriver.Chrome("/path/to/chromedriver.exe", options = options)

with the following options :

options = Options()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('start-maximized')
options.add_argument('disable-infobars')
options.add_argument("--disable-extensions")

prefs = {"profile.managed_default_content_settings.images": 2}
options.add_experimental_option("prefs", prefs)

I get the following Exception:

---------------------------------------------------------------------------
SessionNotCreatedException                Traceback (most recent call last)
 in 
      9 options.add_experimental_option("prefs", prefs)
     10 
---> 11 driver = webdriver.Chrome("C:/Users/cnemri/Documents/Tutorials/End-to-End ML/chromedriver_win32/chromedriver.exe", options = options)
     12 
     13 timeout = 3

~\Anaconda3\lib\site-packages\selenium\webdriver\chrome\webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
     79                     remote_server_addr=self.service.service_url,
     80                     keep_alive=keep_alive),
---> 81                 desired_capabilities=desired_capabilities)
     82         except Exception:
     83             self.quit()

~\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
    155             warnings.warn("Please use FirefoxOptions to set browser profile",
    156                           DeprecationWarning, stacklevel=2)
--> 157         self.start_session(capabilities, browser_profile)
    158         self._switch_to = SwitchTo(self)
    159         self._mobile = Mobile(self)

~\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in start_session(self, capabilities, browser_profile)
    250         parameters = {"capabilities": w3c_caps,
    251                       "desiredCapabilities": capabilities}
--> 252         response = self.execute(Command.NEW_SESSION, parameters)
    253         if 'sessionId' not in response:
    254             response = response['value']

~\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
    319         response = self.command_executor.execute(driver_command, params)
    320         if response:
--> 321             self.error_handler.check_response(response)
    322             response['value'] = self._unwrap_value(
    323                 response.get('value', None))

~\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
    240                 alert_text = value['alert'].get('text')
    241             raise exception_class(message, screen, stacktrace, alert_text)
--> 242         raise exception_class(message, screen, stacktrace)
    243 
    244     def _value_or_default(self, obj, key, default):

SessionNotCreatedException: Message: session not created
from disconnected: unable to connect to renderer
  (Session info: headless chrome=83.0.4103.106)

My OS is windows 10. I am using Python 3.7.6 and Anaconda as environment manager.

Thank you in advance for your help.

cnemri
  • 454
  • 4
  • 14

1 Answers1

0
driver = webdriver.Chrome("/path/to/chromedriver.exe", options = options)

When you replace chromedriver exe you need to refresh project and rerun it

frianH
  • 7,295
  • 6
  • 20
  • 45
Justin Lambert
  • 940
  • 1
  • 7
  • 13