Skip to content

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

Open

Description

@haavardw

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>

Activity

  1. haavardw commented on Oct 13, 2021

    @haavardw
    ContributorAuthor

    downgrading to selenium == 3.141.0 works around the issue

  2. kevin-pelago commented on Oct 14, 2021

    @kevin-pelago

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

    downgrading to selenium == 3.141.0 works around the issue

  3. haavardw commented on Oct 14, 2021

    @haavardw
    ContributorAuthor

    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.

  4. spyoungtech commented on Dec 11, 2021

    @spyoungtech
    Owner

    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).

  5. shayneoneill commented on Oct 17, 2023

    @shayneoneill

    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)

  6. spyoungtech commented on Oct 26, 2023

    @spyoungtech
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions