Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases #88

Open
haavardw opened this issue Oct 13, 2021 · 6 comments

Comments

@haavardw
Copy link
Contributor

haavardw commented Oct 13, 2021

Broken with selenium 4.0.0.

Reproduced with python 3.8.10 and 3.9.5

File "xxxxxxxxxxxx/venv/lib/python3.8/site-packages/behave_webdriver/conditions.py", line 48, in <module>
   class element_is_selected(NegationMixin, EC.element_located_to_be_selected):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Reproducable by running package tests:

git/behave-webdriver$ python setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing behave_webdriver.egg-info/PKG-INFO
writing dependency_links to behave_webdriver.egg-info/dependency_links.txt
writing requirements to behave_webdriver.egg-info/requires.txt
writing top-level names to behave_webdriver.egg-info/top_level.txt
reading manifest file 'behave_webdriver.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'behave_webdriver.egg-info/SOURCES.txt'
running build_ext
behave_webdriver (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: behave_webdriver (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: behave_webdriver
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/home/haavardw/git/behave-webdriver/behave_webdriver/__init__.py", line 15, in <module>
    from behave_webdriver.driver import (Chrome,
  File "/home/haavardw/git/behave-webdriver/behave_webdriver/driver.py", line 18, in <module>
    from behave_webdriver.conditions import (element_is_present,
  File "/home/haavardw/git/behave-webdriver/behave_webdriver/conditions.py", line 48, in <module>
    class element_is_selected(NegationMixin, EC.element_located_to_be_selected):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>

@haavardw
Copy link
Contributor Author

downgrading to selenium == 3.141.0 works around the issue

@kevin-pelago
Copy link

I'm also encountering this issue. downgrading selenium works for me too.

downgrading to selenium == 3.141.0 works around the issue

@haavardw
Copy link
Contributor Author

selenium 4.0.0 was released yesterday and has changed EC.element_located_to_be_selected (and all the other classes in the same file) from being classes to functions, breaking the behave-webdriver pattern of inheritance and mixins.

@spyoungtech
Copy link
Owner

spyoungtech commented Dec 11, 2021

Thanks for tracking down the breaking change. I'll see if I can update the code to play nice in selenium 3.x and 4.x

For now, I've set selenium < 4 in the requirements (released oct 25 with v0.3.1).

@shayneoneill
Copy link

Whats the status on fixing this. Older versions of selenium seem to be incompatible with modern versions of URLLIB3 (urllib3 changed something to do with socket timeouts)

@spyoungtech
Copy link
Owner

Hi @shayneoneill I don't think I have a great answer for this right now. I'm not currently actively developing this project. I may find some time to take a closer look, but I can't make any promises right now.

I would be willing to review and accept pull requests for a fix, however, if someone else wants to take a stab at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants