Following is my appium spec for Android
Java-client 5.0.4
Appium 1.7.2
Maven
Im unable to scroll to the particular element and click on it, want to use generic way of getting the device size and dimension and scroll and not by cordinates have tried below url solutions but not working for me,please can anyone help me out its kinda urgent
For some reason i changed it it was able to scroll but not click on the element but now i am unable to scroll and click,please help
@FindBy(id=“com.licious:id/nav_view”)
public WebElement scrolltoAccount;
Thanks a lot buddy it worked;)
For text it worked but when i use id im getting error because most of the elements has id
getDriver().findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().resourceIdMatches(“com.test:id/rvDeals”)).scrollIntoView(”
+ “new UiSelector().text(”"+text+""));")) // (in text how can we pass id)
can u suggest for by using id
in official documentation they have given java script executor but is not working
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put(“direction”, “down”);
scrollObject.put(“element”, ((RemoteWebElement) element).getId());
js.executeScript(“mobile: scroll”, scrollObject); Is JavaScriptExecutor works for Appium? but this is for co-ordinates
For horizontal scroll/swipe i have tried the following but its clicking on the element instead of swipe may be because of the perform action
public void horizontalScroll()
{
TouchAction action = new TouchAction(getDriver());
int startY = mhpageobjects.swipeWeekenedtreats.getLocation().getY() + (mhpageobjects.swipeWeekenedtreats.getSize().getHeight() / 2);
int startX = mhpageobjects.swipeWeekenedtreats.getLocation().getX() + (mhpageobjects.swipeWeekenedtreats.getSize().getWidth() / 2);
int endX = mhpageobjects.swipeWeekenedtreats.getLocation().getX() + (mhpageobjects.swipeWeekenedtreats.getSize().getWidth() / 2);
int endY = mhpageobjects.swipeWeekenedtreats.getLocation().getY() + (mhpageobjects.swipeWeekenedtreats.getSize().getHeight() / 2);
action.press(startX, startY).waitAction().moveTo(endX, endY).release().perform();
}
Can u suggest a way to swipe horizontal it would be of great help