I am trying to use Python Selenium to click a button on a webpage, but Selenium is giving exception "Element is not currently visible and so may not be interacted with".
The DOM structure is quite simple:
<body style="overflow: hidden;">
...
    <div aria-hidden="false" style="display: block; ...">
        ...
        <button id="button-aaa" aria-hidden="true" style="...">
        ...
    </div>
...
</body>
I have searched Google and Stackoverflow. Some users say Selenium cannot click a web element which is under a parent node with overflow: hidden. But surprisingly, I found that Selenium is able to click some other buttons which are also under a parent node with overflow: hidden.
Anyway, I have tried to use driver.execute_script to change the <body> style to overflow: none, but Selenium is still unable to click this button.
I have also tried to change the button's aria-hidden="true" to aria-hidden="false", but Selenium still failed to click.
I have also tried to add "display: block;" to the button's style, and tried all different combination of style changes, but Selenium still failed to click.
I have used this commands to check the button: buttonelement.is_displayed(). It always returns False no matter what style I change in the DOM. The button is clearly visually visible in the Firefox browser, and it is clickable and functioning. By using the Chrome console, I am able to select the button using ID.
May I know how can I check what is causing a web element to be invisible to Python Selenium?
Overflow takes only one of five values (overflow: auto | hidden | scroll | visible | inherit). Use visible
How to check what is causing a web element to be invisible to Python Selenium?