question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension of keyword Drag And Drop By Coordinates: make release of the mouse button flexible

See original GitHub issue

So far the keyword “Drag And Drop By Coordinates” does the following:

First it moves the mouse to the start-point,
then presses the left mouse button,
then moves to the end-point in specified number of steps,
then releases the mouse button.

I’d suggest to add a boolean parameter “release” which controls whether the mouse button at the end is released or not.

The default value would be True so that nothing would change for existing calls of the keyword.

The extended keyword used in sequence allows to drag the mouse several times to different coordinates before the mouse button is released.

This would allow a more realistic simulation of user interaction.

And it would allow to test GUI elements that react permanently on the position of the mouse like virtual joysticks.

Suggestion to Browser/keywords/interaction.py, not tested yet:

OLD:

def drag_and_drop_by_coordinates(
        self, from_x: float, from_y: float, to_x: float, to_y: float, steps: int = 1
    ):  ...
        self.mouse_button(MouseButtonAction.down, x=from_x, y=from_y)
        self.mouse_move(x=to_x, y=to_y, steps=steps)
        self.mouse_button(MouseButtonAction.up)

NEW:

def drag_and_drop_by_coordinates(
        self, from_x: float, from_y: float, to_x: float, to_y: float, steps: int = 1, release: bool = True
    ):  ...
        self.mouse_button(MouseButtonAction.down, x=from_x, y=from_y)
        self.mouse_move(x=to_x, y=to_y, steps=steps)
        if release:
            self.mouse_button(MouseButtonAction.up)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
UliSeicommented, Feb 10, 2022

Agree. Thanks for that hint, just in time. If there aren’t any objections I am going to implement it next week with no_drop argument.

0reactions
aaltatcommented, Mar 2, 2022

Done in #1799

Read more comments on GitHub >

github_iconTop Results From Across the Web

coordinates
Adds a mouse position tooltip, with its x and y coordinates. Also measures areas of regions. Note local files: In the extension details...
Read more >
Chapter 18 - Automate the Boring Stuff with Python
At a high level, here's what your program should do: Display the current x- and y-coordinates of the mouse cursor. Update these coordinates...
Read more >
cursor - CSS: Cascading Style Sheets - MDN Web Docs
The cursor CSS property sets the mouse cursor, if any, to show when the mouse pointer is over an element.
Read more >
[WebUI] Click Offset - Katalon Docs
Click on the given element with the relative position (x, y) from the in-view center point of that element. ... import com.kms.katalon.core.webui.keyword.
Read more >
Auto clicker chrome os
You can input more than one coordinate pair and make the auto clicker run in ... Mouse Click Every Minute, Second or Milli...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found