Facing Issue in scrolling field of Native Contacts Application

Facing Issue in scrolling and selecting an field in native contacts application of android.

For Ex: I need to create a contact through native contacts application with below details:
Contact Name:Device C Contact
Phone field :1234567890 ,Field Type:Other
Phone field :0123456789 ,Field Type:Pager
Here in the above example I am failing to select the field types on the device.

Attached is the device image which reflects the field which I need to scroll and select.

Below is the command which I have used for scrolling:

HashMap scrollObject = new HashMap();
RemoteWebElement element = (RemoteWebElement) ((AndroidDriver) driver).findElementByAndroidUIAutomator(“new UiSelector().className(“android.widget.Spinner”)”);
JavascriptExecutor js = (JavascriptExecutor) driver;
String webElementId = ((RemoteWebElement) element).getId();
System.out.println(webElementId);System.out.println(element);
scrollObject.put(“text”, keyword);
scrollObject.put(“element”, webElementId);
js.executeScript(“mobile: scrollTo”, scrollObject);

You can check my video, May be it will help you
Appium Tutorial-Swipe and Scrollto: http://youtu.be/Z228YKNBrgM

1 Like

Thanks for the quick reply!

I am able to scroll and select the fields with the ScrollTo & ScrollToExact commands successfully but facing an another issue during automating this.Whenever I try to create a contact with 21 fields it gets failed randomly and I get “org.openqa.selenium.NoSuchElementException” error.

Attached is the script Contact Add Script.txt (8.0 KB) and TestNG result log(TestNG fail result_1.txt (4.7 KB) ) which shows the random failure of script.
It would be helpful if you can look into this.

Any updates on random failure of script issue?