0

#This is the code that i tried to use chrome driver

from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys


driver=webdriver.Chrome(r"/usr/local/bin/chromedriver")

#But the error is coming..

<ipython-input-118-b695456c07d9>:6: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver=webdriver.Chrome(r"/usr/local/bin/chromedriver")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-118-b695456c07d9> in <module>
      4 
      5 
----> 6 driver=webdriver.Chrome(r"/usr/local/bin/chromedriver")

3 frames
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
    114     def assert_process_still_running(self) -> None:
    115         """Check if the underlying process is still running."""
--> 116         return_code = self.process.poll()
    117         if return_code:
    118             raise WebDriverException(f"Service {self.path} unexpectedly exited. Status code was: {return_code}")

AttributeError: 'Service' object has no attribute 'process'

I checked the version of Chrome and Chrome driver and the path. But I can't solve it. I'm a real beginner who doesn't know much about Python, however, I have to crawl some data, but I can't even install a chrome driver. Please help me, Python masters

Whywhywhy
  • 1
  • 2
  • Have a look [here](https://stackoverflow.com/questions/64717302/deprecationwarning-executable-path-has-been-deprecated-selenium-python). I think your question is answered there – Shatas Dec 01 '22 at 14:21

1 Answers1

0

In the latest Selenium version, executable_path has been deprecated, so you have to use Service:

from selenium.webdriver.chrome.service import Service

driver = webdriver.Chrome(service=Service(<chromedriver.exe path>))
driver.get(<URL>)
AbiSaran
  • 2,538
  • 3
  • 9
  • 15