Strangely a week ago the code started giving errors.
selenium=4.1.3 // windows 10
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_driver = ChromeDriverManager().install()
driver = Chrome(service=Service(chrome_driver), chrome_options=chrome_options)
Error:
c:UsersUserDesktoptext.py:14: DeprecationWarning: use options instead of chrome_options
driver = Chrome(service=Service(chrome_driver), chrome_options=chrome_options)
Traceback (most recent call last):
File "c:UsersUserDesktoptext.py", line 14, in <module>
driver = Chrome(service=Service(chrome_driver), chrome_options=chrome_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersUserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagesseleniumwebdriverchromewebdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:UsersUserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagesseleniumwebdriverchromiumwebdriver.py", line 90, in __init__
self.service.start()
File "C:UsersUserAppDataLocalPackagesPythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0LocalCachelocal-packagesPython311site-packagesseleniumwebdrivercommonservice.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0Libsubprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0Libsubprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 non è un'applicazione di Win32 valida
What could it be?
I tried to update selenium or chromedriver
New contributor
Luca is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.