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

Element not found with Zalenium webdriver and scrolled down #128

Open
hhovsepy opened this issue Nov 29, 2018 · 1 comment
Open

Element not found with Zalenium webdriver and scrolled down #128

hhovsepy opened this issue Nov 29, 2018 · 1 comment

Comments

@hhovsepy
Copy link

On a page written in react, when executing tests on remote Zalenium webdriver, and the opened page is scrolled down that some particular Button is not visible, that button.click can not find the button by locator.
But when scrolling the page up, button.click works fine.

Added this workaround: https://github.com/Kiali-QE/kiali-qe-python/blob/master/kiali_qe/components/__init__.py#L461
Happened on "Metrics Settings" checkbox filter button.

screenshot from 2018-11-29 13-09-55

@mfalesni
Copy link
Contributor

mfalesni commented Dec 5, 2018

If I were still working on Widgetastic, I would probably suggest creating a sort of "middleware" system for the methods of browser and decorate all relevant browser methods with it:

@plugin_handler
def move_to_element(self, ...):
    # ...

Then the plugin_handler would look into the browser plugin instance for clues what to do when anything unexpected happens. Might be a simple value (retry_stale_element could be moved into that middleware as a retry_stale_element = True|False), or a method per browser-method where one could fine-tune things the framework does when situations specific to the project happen and drive it from there. An example for this use case could look something like this:

class MyBrowserPlugin(BrowserPlugin):
    class Handlers:
        def move_to_element(self, executor):
            try:
                return executor()
            except AnException:
                if executor.params.something:
                    raise  # Give up based on the params passed to the move_to_elements
                do_something()
                return executor(with_modified_param="eg_foo")

    class Tweaks:
        retry_on_stale_element = {'move_to_element', 'whatever_else'}

btw. hai 👋

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

2 participants