Skip to content

Commit

Permalink
Webui: use service options to init Firefox driver
Browse files Browse the repository at this point in the history
With selenium driver 4.10 and above, the API for Firefox driver
initialization has changed and does not use any more the
log_path argument.

The log path is now provided through a FirefoxService option
in the webdriver initialization.

Fixes: https://pagure.io/freeipa/issue/9492
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
  • Loading branch information
flo-renaud committed Dec 11, 2023
1 parent 9abb50e commit 25b58e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ipatests/test_webui/ui_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import time
from datetime import datetime
from functools import wraps
from pkg_resources import parse_version
from urllib.error import URLError

import pytest
Expand Down Expand Up @@ -268,7 +269,15 @@ def get_driver(cls):
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)
webdriver_version = parse_version(webdriver.__version__)
if webdriver_version < parse_version('4.10.0'):
driver = webdriver.Firefox(fp, log_path=ff_log_path)
else:
service = webdriver.FirefoxService(
log_output=ff_log_path,
service_args=['--log', 'debug'])
driver = webdriver.Firefox(fp, service=service)

except URLError as e:
pytest.skip(
'Error connecting to selenium server: %s' % e
Expand Down

0 comments on commit 25b58e6

Please sign in to comment.