AppiumTestDistribution / appium-gestures-plugin

Appium plugin designed to perform gestures using W3C Actions.
47 stars 13 forks source link

What if the WebElement I am using was not assigned with an Id ? #76

Closed vnuta9 closed 1 year ago

vnuta9 commented 1 year ago

@saikrishna321 Hello Sai; Let us say I want to do swiping of a WebElement, which was not assigned by Id attribute ? It is possible since we are testing a Flutter based app, which offers a little less freedom to Developers and some times(rather mostly) does not assign 'id' attribute when you check the WebElement in the AppiumInspector. At the most it would offer accessibilityId, and almost all the time, the 'type' of the WebElement or so called 'tag' of the mark up.

RemoteWebElement slider = (RemoteWebElement) driver.findElement(AppiumBy.accessibilityId("listview"));
driver.executeScript("gesture: swipe", ImmutableMap.of("elementId", slider.getId(), "percentage", 50, "direction", "up"));

Will we be able to use the above code for swiping action ??? Thanks a lot,

saikrishna321 commented 1 year ago

You need a view element to scroll. So if ur able to see accessibility locator in appium inspector then this code will work.