Skip to content

[🐛 Bug]: test/unit/selenium/webdriver/ie/test_ie_options.py::test_element_scroll_behavior fails w/ selenium-python 4.11.0 #12459

@mgorny

Description

@mgorny

What happened?

With selenium-4.11.0 and git 4beab57, I can reproduce the following unit test failure:

FAILED test/unit/selenium/webdriver/ie/test_ie_options.py::test_element_scroll_behavior - ValueError: elementScrollBehavior should be of type int

FWICS, the problem is that ElementScrollBehavior is defined as an Enum, while an int is expected. The issue can possibly be fixed by changing it to an IntEnum instead.

The other possibility is to change element_scroll_behavior to expect Enum but that requires more changes to the code and probably breaks backwards compatibility.

How can we reproduce the issue?

pip install . pytest
python -m pytest -vvl test/unit

Relevant log output

============================================================== FAILURES ===============================================================
____________________________________________________ test_element_scroll_behavior _____________________________________________________

opts = <selenium.webdriver.ie.options.Options object at 0x7fbde0ee1890>

    def test_element_scroll_behavior(opts):
>       opts.element_scroll_behavior = ElementScrollBehavior.BOTTOM

opts       = <selenium.webdriver.ie.options.Options object at 0x7fbde0ee1890>

test/unit/selenium/webdriver/ie/test_ie_options.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.ie.options._IeOptionsDescriptor object at 0x7fbde1100f90>
obj = <selenium.webdriver.ie.options.Options object at 0x7fbde0ee1890>, value = <ElementScrollBehavior.BOTTOM: 1>

    def __set__(self, obj, value) -> None:
        if not isinstance(value, self.expected_type):
>           raise ValueError(f"{self.name} should be of type {self.expected_type.__name__}")
E           ValueError: elementScrollBehavior should be of type int

obj        = <selenium.webdriver.ie.options.Options object at 0x7fbde0ee1890>
self       = <selenium.webdriver.ie.options._IeOptionsDescriptor object at 0x7fbde1100f90>
value      = <ElementScrollBehavior.BOTTOM: 1>

selenium/webdriver/ie/options.py:59: ValueError

Operating System

Gentoo Linux

Selenium version

Python 4.11.0

What are the browser(s) and version(s) where you see this issue?

n/a

What are the browser driver(s) and version(s) where you see this issue?

n/a

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-pyPython BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions