appium / appium-windows-driver

Appium's interface to WindowsAppDriver provided by Microsoft
Apache License 2.0
131 stars 35 forks source link

Scrolling on The Page #229

Open dsa45632 opened 11 months ago

dsa45632 commented 11 months ago

Warning: I am following this to make scrolling on the page https://github.com/appium/appium-windows-driver#windows-scroll. But whatever I do I keep getting unknown server-side issues, I am just trying to scroll down and up on the page . I see element id or x and y coordinates must be provided but If I am doing scrolling through the page I believe I don't need those coordinates right? anyway if I do I still get an issue. Here is my logic

1- Map<String, Object> params = new HashMap<>(); // // params.put("elementId", startElementId); params.put("x", 100); params.put("y", 100);

 params.put("deltaY", 100);

    windowsDriver.get().executeScript("windows:scroll", params);
}

if I put element id there and take off x and y coordinates I still get issues , I tried to put ms duration time as well but that does not change anything still same issue, Any suggestions please?

mykola-mokhnach commented 11 months ago

This endpoint actually emulates the vertical or horizontal rotation of the mouse wheel. So, make sure you can scroll the given element at the given coordinate manually. Also verify if it needs to have the focus to be able to scroll.

dsa45632 commented 11 months ago

I have tried that but It did not work, is there any examples I can refer too please?

mykola-mokhnach commented 11 months ago

What if you increase deltaY by multiplying it to 120?

The documentation to this API says

If dwFlags contains MOUSEEVENTF_WHEEL, then mouseData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120.

mastafungus commented 8 months ago

I have the same issue. I've tried to increase deltaY by multiplying it to 120 without success. My test PASS but no scrolling.

def windows_scrolling(locator):
    # Get the Appium driver instance
    appium_lib = BuiltIn().get_library_instance('AppiumLibrary')
    driver = appium_lib._current_application()

    # Find the element
    element = locator_to_element(locator, driver)

    # Get the element's coordinates
    x = element.location['x']
    y = element.location['y']

    # Log the coordinates
    BuiltIn().log(f"Scrolling to the element at coordinates ({x}, {y})")

    # Scroll down
    driver.execute_script('windows: scroll', {'x': x, 'y': y, 'deltaY': -360})

Appium windows driver : 2.12.16

Any suggestions ?