vendredi 3 août 2018

Scroll Date Picker using mobile: selectPickerWheelValue in appium

I am working with appium and i am trying to select date from Date picker for iOS.

Here is my Code

JavascriptExecutor js = (JavascriptExecutor) driver;
    Map<String, Object> params = new HashMap();
    params.put("order", "next");
    params.put("offset", 0.15);
    params.put("element", dayPicker);
    for (int i=0;i<10;i++) {
        js.executeScript("mobile: selectPickerWheelValue", params);
    }

I want to select day as 10 , some month and year. Below is the snapshot of ui.

enter image description here

But i am getting following error message when i try to use the above code.

org.openqa.selenium.WebDriverException: An unknown server-side error 
occurred while processing the command. Original error: Error 
Domain=com.facebook.WebDriverAgent Code=1 "Picker wheel value has not 
been changed after 2 seconds timeout" UserInfo= . 
{NSLocalizedDescription=Picker wheel value has not been changed after 2 
seconds timeout}
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'

I also tried scroll.But, unfortunately scroll is happening 2 times and getting stopped. Here is the code.

JavascriptExecutor js = (JavascriptExecutor) driver;
    Map<String, Object> params = new HashMap();
    params.put("element", dayPicker);
    params.put("direction", "down");
    params.put("text", "10");
    params.put("toVisible", "true");
    js.executeScript("mobile: scroll" , params);
    System.out.println("******"+dayPicker.getText());

i also want to select country from country list in other part of application. so it would be helpful if you can help me out on how to use these methods like scroll , swipe

I am using latest appium desktop version 1.6 and appium server 1.8.

Aucun commentaire:

Enregistrer un commentaire