Skip to content

suggestion: implementation of click and hold behavior #26

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

Open
magowiz opened this issue Dec 8, 2022 · 0 comments
Open

suggestion: implementation of click and hold behavior #26

magowiz opened this issue Dec 8, 2022 · 0 comments

Comments

@magowiz
Copy link

magowiz commented Dec 8, 2022

To interact correctly with MDSwitch widget, I needed to have a click and hold behavior in order to change its state:
click_on and wait_click methods from client are not working in this case, so I found a tricky workaround for this that I would like to share:

I managed to do this using wait_drag client method, putting as selector the Thumb and as target the same, specifying a proper duration and timeout, in this way I was able to reproduce desired behavior.

Here it is the code I wrote:

switch_locator = f'//MDSwitch[@name~="{provider_name}"]/Thumb[0]'
cli.wait_drag(switch_locator, switch_locator, duration=3, timeout=30)

Maybe it could be useful to implement a click_hold_on or a wait_click_hold method inside client that can use this "trick".
What do you think?

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

1 participant