#9492 WebUI tests: code not compatible with selenium driver 4.10
Closed: fixed a year ago by frenaud. Opened a year ago by frenaud.

Issue

The webui tests running on f39 and rawhide are failing because the code is failing to initialize Selenium driver.

Example of test failure in PR #3198: test_webui_cert logs and report:

self = <ipatests.test_webui.test_cert.test_cert object at 0x7fd070f21fd0>
request = <SubRequest 'ui_driver_fsetup' for <Function test_read>>

    @pytest.fixture(autouse=True)
    def ui_driver_fsetup(self, request):
>       self.driver = self.get_driver()

test_webui/ui_driver.py:172: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'ipatests.test_webui.test_cert.test_cert'>

    @classmethod
    def get_driver(cls):
        """
        Get WebDriver according to configuration
        """
        browser = cls.config["browser"]
        port = cls.config["port"]
        driver_type = cls.config["type"]

        options = None

        if browser == 'chromium':
            options = ChromeOptions()
            options.binary_location = paths.CHROMIUM_BROWSER

        if driver_type == 'remote':
            if 'host' not in cls.config:
                pytest.skip('Selenium server host not configured')
            host = cls.config["host"]

            if browser == 'chrome':
                capabilities = DesiredCapabilities.CHROME
            elif browser == 'chromium':
                capabilities = options.to_capabilities()
            elif browser == 'ie':
                capabilities = DesiredCapabilities.INTERNETEXPLORER
            else:
                capabilities = DesiredCapabilities.FIREFOX
            try:
                driver = webdriver.Remote(
                    command_executor='http://%s:%d/wd/hub' % (host, port),
                    desired_capabilities=capabilities)
            except URLError as e:
                pytest.skip(
                    'Error connecting to selenium server: %s' % e
                )
            except RuntimeError as e:
                pytest.skip(
                    'Error while establishing webdriver: %s' % e
                )
        else:
            try:
                if browser in {'chrome', 'chromium'}:
                    driver = webdriver.Chrome(chrome_options=options)
                elif browser == 'ie':
                    driver = webdriver.Ie()
                else:
                    fp = None
                    if "ff_profile" in cls.config:
                        fp = webdriver.FirefoxProfile(cls.config["ff_profile"])
                    ff_log_path = cls.config.get("geckodriver_log_path")
>                   driver = webdriver.Firefox(fp, log_path=ff_log_path)
E                   TypeError: WebDriver.__init__() got an unexpected keyword argument 'log_path'

The webui test are using selenium.webdriver.Firefox class but the interface has changed with selenium 4.10 (see selenium issue #12030 fixed in 4.10 - changelog)

On the vagrant images used for fedora 39 and rawhide, the selenium driver is 4.15 and the test is not compatible any more because the driver is initialized with deprecated parameters.

The test code needs to be adapted and work with all versions of the driver.


Metadata Update from @frenaud:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/7105

a year ago

master:

  • 25b58e6 Webui: use service options to init Firefox driver

ipa-4-11:

  • 9f86fcf Webui: use service options to init Firefox driver

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

a year ago

Log in to comment on this ticket.

Metadata