error while using Selenium webdriver on python
driver = webdriver.Chrome(path)
driver = webdriver.Chrome(ChromeDriverManager().install())
same error is getting for both-'str' object has no attribute 'capabilities'
can anyone resolve it?
error while using Selenium webdriver on python
driver = webdriver.Chrome(path)
driver = webdriver.Chrome(ChromeDriverManager().install())
same error is getting for both-'str' object has no attribute 'capabilities'
can anyone resolve it?
You may try using the Service()
class along with ChromeDriverManager().install()
:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
and you'll need to install
pip install selenium
pip install webdriver-manager
reference:
If you are using selenium version 4.6.0
or higher, you do not really need WebDriverManager
as selenium has an in-built tool known as SeleniumManager
which does what WDM
used to do.
Code can be as simple as:
from selenium import webdriver
driver = webdriver.Chrome()
References: https://stackoverflow.com/a/76463081/7598774