Open
Description
Hi,
We're seeing errors when trying to run pytest-selenium 4.0.2 and selenium 4.16.0 with Firefox as the driver. I'm guessing this is due to the recent changes in #317? The same tests running in Chrome seem to be OK.
- Firefox version: 120
- Selenium version: 4.16.0
- pytest-selenium version: 4.0.2
- geckodriver version: 0.33.0
I've attached the stacktrace we're seeing below.
__________________________________________________ ERROR at setup of test_firefox_account_modal ___________________________________________________
request = <SubRequest 'driver' for <Function test_firefox_account_modal>>, driver_class = <class 'selenium.webdriver.firefox.webdriver.WebDriver'>
driver_kwargs = {'options': <selenium.webdriver.firefox.options.Options object at 0x1101fbd00>, 'service': <selenium.webdriver.firefox.service.Service object at 0x1101fbfd0>}
@pytest.fixture
def driver(request, driver_class, driver_kwargs):
"""Returns a WebDriver instance based on options and capabilities"""
retries = int(request.config.getini("max_driver_init_attempts"))
> for retry in Retrying(
stop=stop_after_attempt(retries), wait=wait_exponential(), reraise=True
):
driver_class = <class 'selenium.webdriver.firefox.webdriver.WebDriver'>
driver_kwargs = {'options': <selenium.webdriver.firefox.options.Options object at 0x1101fbd00>, 'service': <selenium.webdriver.firefox.service.Service object at 0x1101fbfd0>}
request = <SubRequest 'driver' for <Function test_firefox_account_modal>>
retries = 3
retry = <tenacity.AttemptManager object at 0x11004a1c0>
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/pytest_selenium/pytest_selenium.py:176:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/tenacity/__init__.py:347: in __iter__
do = self.iter(retry_state=retry_state)
do = <tenacity.DoAttempt object at 0x11004a580>
retry_state = <RetryCallState 4563708416: attempt #3; slept for 3.0; last result: failed (ValueError I/O operation on closed file)>
self = <Retrying object at 0x11004aa90 (stop=<tenacity.stop.stop_after_attempt object at 0x11004ac40>, wait=<tenacity.wait.wa...bject at 0x102d327c0>, before=<function before_nothing at 0x102d2eaf0>, after=<function after_nothing at 0x102d2ec10>)>
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/tenacity/__init__.py:325: in iter
raise retry_exc.reraise()
fut = <Future at 0x11004a220 state=finished raised ValueError>
is_explicit_retry = False
retry_exc = RetryError(<Future at 0x11004a220 state=finished raised ValueError>)
retry_state = <RetryCallState 4563708416: attempt #3; slept for 3.0; last result: failed (ValueError I/O operation on closed file)>
self = <Retrying object at 0x11004aa90 (stop=<tenacity.stop.stop_after_attempt object at 0x11004ac40>, wait=<tenacity.wait.wa...bject at 0x102d327c0>, before=<function before_nothing at 0x102d2eaf0>, after=<function after_nothing at 0x102d2ec10>)>
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/tenacity/__init__.py:158: in reraise
raise self.last_attempt.result()
self = RetryError(<Future at 0x11004a220 state=finished raised ValueError>)
../../../.pyenv/versions/3.9.10/lib/python3.9/concurrent/futures/_base.py:439: in result
return self.__get_result()
self = None
timeout = None
../../../.pyenv/versions/3.9.10/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
raise self._exception
self = None
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/pytest_selenium/pytest_selenium.py:183: in driver
driver = driver_class(**driver_kwargs)
driver_class = <class 'selenium.webdriver.firefox.webdriver.WebDriver'>
driver_kwargs = {'options': <selenium.webdriver.firefox.options.Options object at 0x1101fbd00>, 'service': <selenium.webdriver.firefox.service.Service object at 0x1101fbfd0>}
request = <SubRequest 'driver' for <Function test_firefox_account_modal>>
retries = 3
retry = <tenacity.AttemptManager object at 0x11004a1c0>
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py:60: in __init__
self.service.start()
__class__ = <class 'selenium.webdriver.firefox.webdriver.WebDriver'>
keep_alive = True
options = <selenium.webdriver.firefox.options.Options object at 0x1101fbd00>
self = <[AttributeError("'WebDriver' object has no attribute 'session_id'") raised in repr()] WebDriver object at 0x11004a100>
service = <selenium.webdriver.firefox.service.Service object at 0x1101fbfd0>
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/selenium/webdriver/common/service.py:98: in start
self._start_process(self._path)
self = <selenium.webdriver.firefox.service.Service object at 0x1101fbfd0>
../../../.pyenv/versions/3.9.10/envs/bedrock/lib/python3.9/site-packages/selenium/webdriver/common/service.py:208: in _start_process
self.process = subprocess.Popen(
close_file_descriptors = True
cmd = ['/opt/homebrew/bin/geckodriver', '--port', '51923', '--websocket-port', '51924']
path = '/opt/homebrew/bin/geckodriver'
self = <selenium.webdriver.firefox.service.Service object at 0x1101fbfd0>
start_info = None
../../../.pyenv/versions/3.9.10/lib/python3.9/subprocess.py:829: in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
args = ['/opt/homebrew/bin/geckodriver', '--port', '51923', '--websocket-port', '51924']
bufsize = -1
close_fds = True
creationflags = 0
cwd = None
encoding = None
env = environ({'MANPATH': '/opt/homebrew/share/man:/usr/share/man:/usr/local/share/man:/opt/homebrew/share/man::', 'TERM_PRO..._Angeles', 'PYTEST_CURRENT_TEST': 'tests/functional/firefox/new/test_download.py::test_firefox_account_modal (setup)'})
errors = None
executable = None
extra_groups = None
group = None
pass_fds = ()
preexec_fn = None
restore_signals = True
self = <Popen: returncode: None args: ['/opt/homebrew/bin/geckodriver', '--port', '...>
shell = False
start_new_session = False
startupinfo = None
stderr = <_io.TextIOWrapper name='tests/functional/driver.log' mode='a+' encoding='utf-8'>
stdin = -1
stdout = <_io.TextIOWrapper name='tests/functional/driver.log' mode='a+' encoding='utf-8'>
text = None
umask = -1
universal_newlines = None
user = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Popen: returncode: None args: ['/opt/homebrew/bin/geckodriver', '--port', '...>, stdin = -1
stdout = <_io.TextIOWrapper name='tests/functional/driver.log' mode='a+' encoding='utf-8'>
stderr = <_io.TextIOWrapper name='tests/functional/driver.log' mode='a+' encoding='utf-8'>
def _get_handles(self, stdin, stdout, stderr):
"""Construct and return tuple with IO objects:
p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
"""
p2cread, p2cwrite = -1, -1
c2pread, c2pwrite = -1, -1
errread, errwrite = -1, -1
if stdin is None:
pass
elif stdin == PIPE:
p2cread, p2cwrite = os.pipe()
elif stdin == DEVNULL:
p2cread = self._get_devnull()
elif isinstance(stdin, int):
p2cread = stdin
else:
# Assuming file-like object
p2cread = stdin.fileno()
if stdout is None:
pass
elif stdout == PIPE:
c2pread, c2pwrite = os.pipe()
elif stdout == DEVNULL:
c2pwrite = self._get_devnull()
elif isinstance(stdout, int):
c2pwrite = stdout
else:
# Assuming file-like object
> c2pwrite = stdout.fileno()
E ValueError: I/O operation on closed file
c2pread = -1
c2pwrite = -1
errread = -1
errwrite = -1
p2cread = 29
p2cwrite = 30
self = <Popen: returncode: None args: ['/opt/homebrew/bin/geckodriver', '--port', '...>
stderr = <_io.TextIOWrapper name='tests/functional/driver.log' mode='a+' encoding='utf-8'>
stdin = -1
stdout = <_io.TextIOWrapper name='tests/functional/driver.log' mode='a+' encoding='utf-8'>
../../../.pyenv/versions/3.9.10/lib/python3.9/subprocess.py:1598: ValueError
Metadata
Metadata
Assignees
Labels
No labels