I am running code with pytest and initializing a set of frontend tests with selenium. With no changes in code my selenium chrome tests started crashing with this error, firefox tests pass with no issue. Looks like something not related directly with code but rather my system? Below I’m pasting full log of the error I am receiving. I would appreciate all the help I can get.
<code>__________________________________________________________________________________________ ERROR at setup of TestLoginPage.test_positive_login[chrome] ___________________________________________________________________________________________
request = <SubRequest 'driver' for <Function test_positive_login[chrome]>>
@pytest.fixture(params=["chrome", "firefox"])
def driver(request):
chrome_options = ChromeOptions()
chrome_options.add_argument("--headless=new")
firefox_options = FirefoxOptions()
firefox_options.add_argument("--headless")
browser = request.param
if browser == "chrome":
> my_driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
testsconftest.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venvLibsite-packagesseleniumwebdriverchromewebdriver.py:45: in __init__
super().__init__(
venvLibsite-packagesseleniumwebdriverchromiumwebdriver.py:55: in __init__
self.service.start()
venvLibsite-packagesseleniumwebdrivercommonservice.py:98: in start
self._start_process(self._path)
venvLibsite-packagesseleniumwebdrivercommonservice.py:208: in _start_process
self.process = subprocess.Popen(
C:Python312Libsubprocess.py:1026: in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Popen: returncode: None args: ['C:\Users\piotr\.wdm\drivers\chromedriv...>, args = 'C:\Users\piotr\.wdm\drivers\chromedriver\win64\127.0.6533.72\chromedriver-win32/THIRD_PARTY_NOTICES.chromedriver --port=50326'
executable = None, preexec_fn = None, close_fds = False, pass_fds = (), cwd = None
env = environ({'PSEXECUTIONPOLICYPREFERENCE': 'Bypass', 'TERM_SESSION_ID': 'e631edc2-e7bc-4e74-a22c-08b0e586ad47', 'COMMONPR...SION': '8.2.2', 'PYTEST_CURRENT_TEST': 'tests/test_login_page.py::TestLoginPage::test_positive_login[chrome] (setup)'})
startupinfo = <subprocess.STARTUPINFO object at 0x000002BF518DE270>, creationflags = 0, shell = False, p2cread = Handle(1004), p2cwrite = 16, c2pread = -1, c2pwrite = Handle(784), errread = -1, errwrite = Handle(1032)
unused_restore_signals = True, unused_gid = None, unused_gids = None, unused_uid = None, unused_umask = -1, unused_start_new_session = False, unused_process_group = -1
def _execute_child(self, args, executable, preexec_fn, close_fds,
pass_fds, cwd, env,
startupinfo, creationflags, shell,
p2cread, p2cwrite,
c2pread, c2pwrite,
errread, errwrite,
unused_restore_signals,
unused_gid, unused_gids, unused_uid,
unused_umask,
unused_start_new_session, unused_process_group):
"""Execute program (MS Windows version)"""
assert not pass_fds, "pass_fds not supported on Windows."
if isinstance(args, str):
pass
elif isinstance(args, bytes):
if shell:
raise TypeError('bytes args is not allowed on Windows')
args = list2cmdline([args])
elif isinstance(args, os.PathLike):
if shell:
raise TypeError('path-like args is not allowed when '
'shell is true')
args = list2cmdline([args])
else:
args = list2cmdline(args)
if executable is not None:
executable = os.fsdecode(executable)
# Process startup details
if startupinfo is None:
startupinfo = STARTUPINFO()
else:
# bpo-34044: Copy STARTUPINFO since it is modified above,
# so the caller can reuse it multiple times.
startupinfo = startupinfo.copy()
use_std_handles = -1 not in (p2cread, c2pwrite, errwrite)
if use_std_handles:
startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES
startupinfo.hStdInput = p2cread
startupinfo.hStdOutput = c2pwrite
startupinfo.hStdError = errwrite
attribute_list = startupinfo.lpAttributeList
have_handle_list = bool(attribute_list and
"handle_list" in attribute_list and
attribute_list["handle_list"])
# If we were given an handle_list or need to create one
if have_handle_list or (use_std_handles and close_fds):
if attribute_list is None:
attribute_list = startupinfo.lpAttributeList = {}
handle_list = attribute_list["handle_list"] =
list(attribute_list.get("handle_list", []))
if use_std_handles:
handle_list += [int(p2cread), int(c2pwrite), int(errwrite)]
handle_list[:] = self._filter_handle_list(handle_list)
if handle_list:
if not close_fds:
warnings.warn("startupinfo.lpAttributeList['handle_list'] "
"overriding close_fds", RuntimeWarning)
# When using the handle_list we always request to inherit
# handles but the only handles that will be inherited are
# the ones in the handle_list
close_fds = False
if shell:
startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = _winapi.SW_HIDE
if not executable:
# gh-101283: without a fully-qualified path, before Windows
# checks the system directories, it first looks in the
# application directory, and also the current directory if
# NeedCurrentDirectoryForExePathW(ExeName) is true, so try
# to avoid executing unqualified "cmd.exe".
comspec = os.environ.get('ComSpec')
if not comspec:
system_root = os.environ.get('SystemRoot', '')
comspec = os.path.join(system_root, 'System32', 'cmd.exe')
if not os.path.isabs(comspec):
raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
if os.path.isabs(comspec):
executable = comspec
else:
comspec = executable
args = '{} /c "{}"'.format (comspec, args)
if cwd is not None:
cwd = os.fsdecode(cwd)
sys.audit("subprocess.Popen", executable, args, cwd, env)
# Start the process
try:
> hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
# no special security
None, None,
int(not close_fds),
creationflags,
env,
cwd,
startupinfo)
E OSError: [WinError 193] %1 is not a valid Win32 application
C:Python312Libsubprocess.py:1538: OSError
</code>
<code>__________________________________________________________________________________________ ERROR at setup of TestLoginPage.test_positive_login[chrome] ___________________________________________________________________________________________
request = <SubRequest 'driver' for <Function test_positive_login[chrome]>>
@pytest.fixture(params=["chrome", "firefox"])
def driver(request):
chrome_options = ChromeOptions()
chrome_options.add_argument("--headless=new")
firefox_options = FirefoxOptions()
firefox_options.add_argument("--headless")
browser = request.param
if browser == "chrome":
> my_driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
testsconftest.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venvLibsite-packagesseleniumwebdriverchromewebdriver.py:45: in __init__
super().__init__(
venvLibsite-packagesseleniumwebdriverchromiumwebdriver.py:55: in __init__
self.service.start()
venvLibsite-packagesseleniumwebdrivercommonservice.py:98: in start
self._start_process(self._path)
venvLibsite-packagesseleniumwebdrivercommonservice.py:208: in _start_process
self.process = subprocess.Popen(
C:Python312Libsubprocess.py:1026: in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Popen: returncode: None args: ['C:\Users\piotr\.wdm\drivers\chromedriv...>, args = 'C:\Users\piotr\.wdm\drivers\chromedriver\win64\127.0.6533.72\chromedriver-win32/THIRD_PARTY_NOTICES.chromedriver --port=50326'
executable = None, preexec_fn = None, close_fds = False, pass_fds = (), cwd = None
env = environ({'PSEXECUTIONPOLICYPREFERENCE': 'Bypass', 'TERM_SESSION_ID': 'e631edc2-e7bc-4e74-a22c-08b0e586ad47', 'COMMONPR...SION': '8.2.2', 'PYTEST_CURRENT_TEST': 'tests/test_login_page.py::TestLoginPage::test_positive_login[chrome] (setup)'})
startupinfo = <subprocess.STARTUPINFO object at 0x000002BF518DE270>, creationflags = 0, shell = False, p2cread = Handle(1004), p2cwrite = 16, c2pread = -1, c2pwrite = Handle(784), errread = -1, errwrite = Handle(1032)
unused_restore_signals = True, unused_gid = None, unused_gids = None, unused_uid = None, unused_umask = -1, unused_start_new_session = False, unused_process_group = -1
def _execute_child(self, args, executable, preexec_fn, close_fds,
pass_fds, cwd, env,
startupinfo, creationflags, shell,
p2cread, p2cwrite,
c2pread, c2pwrite,
errread, errwrite,
unused_restore_signals,
unused_gid, unused_gids, unused_uid,
unused_umask,
unused_start_new_session, unused_process_group):
"""Execute program (MS Windows version)"""
assert not pass_fds, "pass_fds not supported on Windows."
if isinstance(args, str):
pass
elif isinstance(args, bytes):
if shell:
raise TypeError('bytes args is not allowed on Windows')
args = list2cmdline([args])
elif isinstance(args, os.PathLike):
if shell:
raise TypeError('path-like args is not allowed when '
'shell is true')
args = list2cmdline([args])
else:
args = list2cmdline(args)
if executable is not None:
executable = os.fsdecode(executable)
# Process startup details
if startupinfo is None:
startupinfo = STARTUPINFO()
else:
# bpo-34044: Copy STARTUPINFO since it is modified above,
# so the caller can reuse it multiple times.
startupinfo = startupinfo.copy()
use_std_handles = -1 not in (p2cread, c2pwrite, errwrite)
if use_std_handles:
startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES
startupinfo.hStdInput = p2cread
startupinfo.hStdOutput = c2pwrite
startupinfo.hStdError = errwrite
attribute_list = startupinfo.lpAttributeList
have_handle_list = bool(attribute_list and
"handle_list" in attribute_list and
attribute_list["handle_list"])
# If we were given an handle_list or need to create one
if have_handle_list or (use_std_handles and close_fds):
if attribute_list is None:
attribute_list = startupinfo.lpAttributeList = {}
handle_list = attribute_list["handle_list"] =
list(attribute_list.get("handle_list", []))
if use_std_handles:
handle_list += [int(p2cread), int(c2pwrite), int(errwrite)]
handle_list[:] = self._filter_handle_list(handle_list)
if handle_list:
if not close_fds:
warnings.warn("startupinfo.lpAttributeList['handle_list'] "
"overriding close_fds", RuntimeWarning)
# When using the handle_list we always request to inherit
# handles but the only handles that will be inherited are
# the ones in the handle_list
close_fds = False
if shell:
startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = _winapi.SW_HIDE
if not executable:
# gh-101283: without a fully-qualified path, before Windows
# checks the system directories, it first looks in the
# application directory, and also the current directory if
# NeedCurrentDirectoryForExePathW(ExeName) is true, so try
# to avoid executing unqualified "cmd.exe".
comspec = os.environ.get('ComSpec')
if not comspec:
system_root = os.environ.get('SystemRoot', '')
comspec = os.path.join(system_root, 'System32', 'cmd.exe')
if not os.path.isabs(comspec):
raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
if os.path.isabs(comspec):
executable = comspec
else:
comspec = executable
args = '{} /c "{}"'.format (comspec, args)
if cwd is not None:
cwd = os.fsdecode(cwd)
sys.audit("subprocess.Popen", executable, args, cwd, env)
# Start the process
try:
> hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
# no special security
None, None,
int(not close_fds),
creationflags,
env,
cwd,
startupinfo)
E OSError: [WinError 193] %1 is not a valid Win32 application
C:Python312Libsubprocess.py:1538: OSError
</code>
__________________________________________________________________________________________ ERROR at setup of TestLoginPage.test_positive_login[chrome] ___________________________________________________________________________________________
request = <SubRequest 'driver' for <Function test_positive_login[chrome]>>
@pytest.fixture(params=["chrome", "firefox"])
def driver(request):
chrome_options = ChromeOptions()
chrome_options.add_argument("--headless=new")
firefox_options = FirefoxOptions()
firefox_options.add_argument("--headless")
browser = request.param
if browser == "chrome":
> my_driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
testsconftest.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venvLibsite-packagesseleniumwebdriverchromewebdriver.py:45: in __init__
super().__init__(
venvLibsite-packagesseleniumwebdriverchromiumwebdriver.py:55: in __init__
self.service.start()
venvLibsite-packagesseleniumwebdrivercommonservice.py:98: in start
self._start_process(self._path)
venvLibsite-packagesseleniumwebdrivercommonservice.py:208: in _start_process
self.process = subprocess.Popen(
C:Python312Libsubprocess.py:1026: in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Popen: returncode: None args: ['C:\Users\piotr\.wdm\drivers\chromedriv...>, args = 'C:\Users\piotr\.wdm\drivers\chromedriver\win64\127.0.6533.72\chromedriver-win32/THIRD_PARTY_NOTICES.chromedriver --port=50326'
executable = None, preexec_fn = None, close_fds = False, pass_fds = (), cwd = None
env = environ({'PSEXECUTIONPOLICYPREFERENCE': 'Bypass', 'TERM_SESSION_ID': 'e631edc2-e7bc-4e74-a22c-08b0e586ad47', 'COMMONPR...SION': '8.2.2', 'PYTEST_CURRENT_TEST': 'tests/test_login_page.py::TestLoginPage::test_positive_login[chrome] (setup)'})
startupinfo = <subprocess.STARTUPINFO object at 0x000002BF518DE270>, creationflags = 0, shell = False, p2cread = Handle(1004), p2cwrite = 16, c2pread = -1, c2pwrite = Handle(784), errread = -1, errwrite = Handle(1032)
unused_restore_signals = True, unused_gid = None, unused_gids = None, unused_uid = None, unused_umask = -1, unused_start_new_session = False, unused_process_group = -1
def _execute_child(self, args, executable, preexec_fn, close_fds,
pass_fds, cwd, env,
startupinfo, creationflags, shell,
p2cread, p2cwrite,
c2pread, c2pwrite,
errread, errwrite,
unused_restore_signals,
unused_gid, unused_gids, unused_uid,
unused_umask,
unused_start_new_session, unused_process_group):
"""Execute program (MS Windows version)"""
assert not pass_fds, "pass_fds not supported on Windows."
if isinstance(args, str):
pass
elif isinstance(args, bytes):
if shell:
raise TypeError('bytes args is not allowed on Windows')
args = list2cmdline([args])
elif isinstance(args, os.PathLike):
if shell:
raise TypeError('path-like args is not allowed when '
'shell is true')
args = list2cmdline([args])
else:
args = list2cmdline(args)
if executable is not None:
executable = os.fsdecode(executable)
# Process startup details
if startupinfo is None:
startupinfo = STARTUPINFO()
else:
# bpo-34044: Copy STARTUPINFO since it is modified above,
# so the caller can reuse it multiple times.
startupinfo = startupinfo.copy()
use_std_handles = -1 not in (p2cread, c2pwrite, errwrite)
if use_std_handles:
startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES
startupinfo.hStdInput = p2cread
startupinfo.hStdOutput = c2pwrite
startupinfo.hStdError = errwrite
attribute_list = startupinfo.lpAttributeList
have_handle_list = bool(attribute_list and
"handle_list" in attribute_list and
attribute_list["handle_list"])
# If we were given an handle_list or need to create one
if have_handle_list or (use_std_handles and close_fds):
if attribute_list is None:
attribute_list = startupinfo.lpAttributeList = {}
handle_list = attribute_list["handle_list"] =
list(attribute_list.get("handle_list", []))
if use_std_handles:
handle_list += [int(p2cread), int(c2pwrite), int(errwrite)]
handle_list[:] = self._filter_handle_list(handle_list)
if handle_list:
if not close_fds:
warnings.warn("startupinfo.lpAttributeList['handle_list'] "
"overriding close_fds", RuntimeWarning)
# When using the handle_list we always request to inherit
# handles but the only handles that will be inherited are
# the ones in the handle_list
close_fds = False
if shell:
startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = _winapi.SW_HIDE
if not executable:
# gh-101283: without a fully-qualified path, before Windows
# checks the system directories, it first looks in the
# application directory, and also the current directory if
# NeedCurrentDirectoryForExePathW(ExeName) is true, so try
# to avoid executing unqualified "cmd.exe".
comspec = os.environ.get('ComSpec')
if not comspec:
system_root = os.environ.get('SystemRoot', '')
comspec = os.path.join(system_root, 'System32', 'cmd.exe')
if not os.path.isabs(comspec):
raise FileNotFoundError('shell not found: neither %ComSpec% nor %SystemRoot% is set')
if os.path.isabs(comspec):
executable = comspec
else:
comspec = executable
args = '{} /c "{}"'.format (comspec, args)
if cwd is not None:
cwd = os.fsdecode(cwd)
sys.audit("subprocess.Popen", executable, args, cwd, env)
# Start the process
try:
> hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
# no special security
None, None,
int(not close_fds),
creationflags,
env,
cwd,
startupinfo)
E OSError: [WinError 193] %1 is not a valid Win32 application
C:Python312Libsubprocess.py:1538: OSError