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);