testdevlab / Py-TestUI

Apache License 2.0
17 stars 1 forks source link

Tests cannot be run via Mozilla Firefox when using python3.11+ #91

Closed Avengess closed 2 months ago

Avengess commented 2 months ago

The script used to trigger this in a python3.11 project:

from testui.support.testui_driver import TestUIDriver
from testui.support.appium_driver import NewDriver

def test(driver: TestUIDriver):
    driver.navigate_to("https://www.google.com")
    driver.save_screenshot("1.png")

driver = NewDriver().set_browser("firefox").set_selenium_driver()
test(driver)

Console output:

Traceback (most recent call last):
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/script.py", line 9, in <module>
    driver = NewDriver().set_browser("firefox").set_selenium_driver()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/testui/support/appium_driver.py", line 384, in set_selenium_driver
    self.__driver = start_selenium_driver(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/testui/support/appium_driver.py", line 540, in start_selenium_driver
    raise err
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/testui/support/appium_driver.py", line 521, in start_selenium_driver
    driver = webdriver.Firefox(options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 212, in __init__
    self.start_session(capabilities)
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 299, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File "/Users/ulvisblathens/Desktop/Py-TestUI local dev/venv/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: marionette is not the name of a known capability or extension capability

Issue was triggered in a python3.12 project as well. Script executes just fine at python3.10. Additionally, when running with Google Chrome instead, then python3.11+ works fine.