I wan to chose a file in cordova andoird app which is using Cordova mfilechooser plugin to broswe files. I used the following Appium code to that. But scroll is not happening.
AndroidElement list = (AndroidElement) driver
.findElement(By.id("android:id/list"));
MobileElement list_group = list.findElement(
MobileBy.AndroidUIAutomator(
"(new UiScrollable(new UiSelector)).scrollIntoView(" +
"new UiSelector.text(\"importSample\"));"
));
list_group.getLocation();
list_group.click();
The below code will work for scrolling the page in browser screen.
We can use Dimension class in selenium: import org.openqa.selenium.Dimension;
CODE:
Dimension size = driver.manage().window().getSize();
int x = size.getWidth() / 2;
int startY = (int) (size.getHeight() * 0.10);
int endY = (int) (size.getHeight() * 0.90);
TouchAction ta = new TouchAction(driver);
ta.press(x, endY).waitAction(Duration.ofSeconds(1)).moveTo(x, startY).release();
ta.perform();