[py] Refactored `conftest.py` in a more object oriented design approach by sandeepsuryaprasad · Pull Request #15495 · SeleniumHQ/selenium
@sandeepsuryaprasad
I pulled your branch and ran the tests that failed in CI, and they passed locally.
However, I found one issue with the tests for WebKitGTK and WPEWebKit... I don't think we run these in CI (not sure why).
for example, if I try to run any test using the --driver=webkitgtk arg, they will fail with AttributeError: module 'selenium.webdriver' has no attribute 'Webkitgtk'. Did you mean: 'webkitgtk'?.
Note the Capitalization... It is trying to instantiate Webkitgtk() rather than the correct class name WebKitGTK().
This is caused by the following line inside your driver function:
driver_class = getattr(request, "param", "Chrome").capitalize()
We can't make the assumption that the class name is always the capitalized request.param. This is not correct in the case of WebKitGTK and WPEWebKit.
You could fix it by replacing that line with:
driver_class = getattr(request, "param", "Chrome").capitalize()
if driver_class == "Webkitgtk":
driver_class = "WebKitGTK"
elif driver_class == "Wpewebkit":
driver_class = "WPEWebKit"
... but perhaps there is a nicer solution?
(BTW, I can't get the --driver=wpewebkit tests to run locally even on trunk, but that is unrelated to your change and I will investigate that separately)