-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[🐛 Bug]: Scrolling in Mobile Devices using WDIO is not working properly #12880
Comments
Can you share some logs how you would do it in Selenide and what you are seeing in WebdriverIO? |
We do it like this in selenide $(By.xpath(".//*[@text='Tabs']")).scrollTo().click(); //scroll max of 30 times in downward direction to find element
$(By.xpath(".//*[@text='Tabs']")).scroll(with(DOWN, 10)); //scroll max of 10 times in downward direction to find element
$(By.xpath(".//*[@text='Animation']")).scroll(up()); //scroll max of 30 times in upward direction to find element
$(By.xpath(".//*[@text='Animation']")).scroll(up(0.15f, 0.60f)); //scroll max of 30 times in upward direction with custom swiping height relative to device height
$(By.xpath(".//*[@text='Animation']")).scroll(down(0.15f, 0.60f)); //scroll max of 30 times in downward direction with custom swiping height relative to device height Please find here my implementation. If I use this code from wdio docs, await driver.touchPerform([
{
action: 'press',
options: {
x: anchor,
y: startPoint,
},
},
{
action: 'wait',
options: {
ms: 100,
},
},
{
action: 'moveTo',
options: {
x: anchor,
y: endPoint,
},
},
{
action: 'release',
options: {},
},
]); then I get this error below: 0] 2024-05-16T13:40:41.759Z INFO webdriver: [GET] http://127.0.0.1:4723/session/de38aae0-b67d-440f-a047-f898dc295946/window/rect If I use below code for scroll from wdio appium boiler plate, await driver
.action("pointer")
.move(anchor, startPoint)
.down()
.pause(2000)
.move({
duration: 1000,
x: anchor,
y: endPoint
})
.up()
.perform(); then I get this below error. |
It seems like in Selenide you are using these selectors: - //[contains(https://github.com/text,'Debug')]
+ .//*[contains(https://github.com/text,'Debug')] |
I don't know why the appium server logs is displaying that but I used correct locator in my code. Actual problem is that the scroll is not happening and hence it cannot find the element. await $("//*[@text='Allow']").click();
await expect($("//android.widget.TextView[contains(@text,'Find Shifts')]")).toBeDisplayed();
await expect($("//*[@text='My Account']")).toBeClickable();
await $("//*[@text='My Account']").click();
await scroll();
await $("//*[contains(@text,'Debug')]").click(); |
Thanks for clarifying. Any support helping us investigate this issue would be appreciated. |
Thanks for reporting! We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers! |
https://gist.github.com/serhatozdursun/25f3c8e26be32fe442abb956ee113ba7 The above code have actually worked. Could you please guide me on how can I override scrollTo method in appium to provide the implementation. I can go over entire code but that would take lot of time. @christian-bromann So users can use $(locator).scrollTo(); |
The implementation for the scroll command can be found here: |
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
latest
Node.js Version
20
Mode
WDIO Testrunner
Which capabilities are you using?
What happened?
I am trying to perform scroll action in native android and ios apps using driver.touchPerform and driver.action but none of them seems to be working.
What is your expected behavior?
I need a function that scrolls to element.
In selenide, we made it very simple like $(element).scrollTo().click();
In WDIO, the scrollIntoView method is not implemented
How to reproduce the bug.
You can try to perform scroll on any android and ios device
Relevant log output
Code of Conduct
Is there an existing issue for this?
The text was updated successfully, but these errors were encountered: