I’ve used Selenium for years but it looks like they’ve changed how you use it and I’m getting nothing but errors. Here’s what I have tried:
from selenium import webdriver
driver = webdriver.Edge('Downloads/msedgedriver.exe')
driver.get('https://www.google.com')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~AppDataRoamingPythonPython37site-packagesseleniumwebdrivercommondriver_finder.py in get_path(service, options)
37 try:
---> 38 path = SeleniumManager().driver_location(options) if path is None else path
39 except Exception as err:
~AppDataRoamingPythonPython37site-packagesseleniumwebdrivercommonselenium_manager.py in driver_location(self, options)
70
---> 71 browser = options.capabilities["browserName"]
72
AttributeError: 'str' object has no attribute 'capabilities'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-16-957b8ee50b85> in <module>
1 from selenium import webdriver
2 # driver = webdriver.Edge()
----> 3 driver = webdriver.Edge('Downloads/msedgedriver.exe')
4 driver.get('https://www.google.com')
~AppDataRoamingPythonPython37site-packagesseleniumwebdriveredgewebdriver.py in __init__(self, options, service, keep_alive)
48 options,
49 service,
---> 50 keep_alive,
51 )
~AppDataRoamingPythonPython37site-packagesseleniumwebdriverchromiumwebdriver.py in __init__(self, browser_name, vendor_prefix, options, service, keep_alive)
49 self.service = service
50
---> 51 self.service.path = DriverFinder.get_path(self.service, options)
52
53 self.service.start()
~AppDataRoamingPythonPython37site-packagesseleniumwebdrivercommondriver_finder.py in get_path(service, options)
38 path = SeleniumManager().driver_location(options) if path is None else path
39 except Exception as err:
---> 40 msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
41 raise NoSuchDriverException(msg) from err
42
AttributeError: 'str' object has no attribute 'capabilities'
from selenium import webdriver
driver = webdriver.Edge()
driver.get('https://www.google.com')
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
~AppDataRoamingPythonPython37site-packagesseleniumwebdrivercommondriver_finder.py in get_path(service, options)
37 try:
---> 38 path = SeleniumManager().driver_location(options) if path is None else path
39 except Exception as err:
~AppDataRoamingPythonPython37site-packagesseleniumwebdrivercommonselenium_manager.py in driver_location(self, options)
89
---> 90 output = self.run(args)
91
~AppDataRoamingPythonPython37site-packagesseleniumwebdrivercommonselenium_manager.py in run(args)
137 if completed_proc.returncode:
--> 138 raise WebDriverException(f"Unsuccessful command executed: {command}.n{result}{stderr}")
139 return result
WebDriverException: Message: Unsuccessful command executed: C:UsersuserAppDataRoamingPythonPython37site-packagesseleniumwebdrivercommonwindowsselenium-manager.exe --browser MicrosoftEdge --output json.
{'code': 65, 'message': 'error sending request for url (https://msedgedriver.azureedge.net/LATEST_RELEASE_127_WINDOWS): error trying to connect: An existing connection was forcibly closed by the remote host. (os error 10054)', 'driver_path': '', 'browser_path': ''}
The above exception was the direct cause of the following exception:
NoSuchDriverException Traceback (most recent call last)
<ipython-input-17-09613be0d9cb> in <module>
1 from selenium import webdriver
----> 2 driver = webdriver.Edge()
3 # driver = webdriver.Edge('Downloads/msedgedriver.exe')
4 driver.get('https://www.google.com')
~AppDataRoamingPythonPython37site-packagesseleniumwebdriveredgewebdriver.py in __init__(self, options, service, keep_alive)
48 options,
49 service,
---> 50 keep_alive,
51 )
~AppDataRoamingPythonPython37site-packagesseleniumwebdriverchromiumwebdriver.py in __init__(self, browser_name, vendor_prefix, options, service, keep_alive)
49 self.service = service
50
---> 51 self.service.path = DriverFinder.get_path(self.service, options)
52
53 self.service.start()
~AppDataRoamingPythonPython37site-packagesseleniumwebdrivercommondriver_finder.py in get_path(service, options)
39 except Exception as err:
40 msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
---> 41 raise NoSuchDriverException(msg) from err
42
43 if path is None or not Path(path).is_file():
NoSuchDriverException: Message: Unable to obtain driver for MicrosoftEdge using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
I’ve tried different tips but want to avoid downloading itself as this is for work and any sort of download requires IT intervention, which is always a roadblock. Any help would be appreciated.