Search code examples
javaandroidappiumtimepicker

how can i select the time in appium


enter image description herethis image show the ui of the elements in the circle

I am trying the

  1. driver.findElement(By.xpath("//android.widget.TextView[@text='5']"));

  2. driver.findElement(By.xpath("//android.widget.RadialTimePickerView$RadialPickerTouchHelper[@content-desc='5']"));

  3. driver.findElement(By.xpath("//android.widget.RadialTimePickerView$RadialPickerTouchHelper[@content-desc='5']")).click();


Solution

  • driver.findElementByAndroidUIAutomator("UiSelector().className(\"android.widget.RadialTimePickerView$RadialPickerTouchHelper\").instance(2)").click(); Thread.sleep(5000); driver.findElementByAndroidUIAutomator("UiSelector().className(\"android.widget.RadialTimePickerView$RadialPickerTouchHelper\").instance(1)").click();

    First link for hour and second for minute for hour: instance 0 means select the 1 hr from watch and instance 1 for select the 2 hr from watch and so on........ for min.:- instance 0 means select the 00 min from watch and instance 1 for select the 0 5min from watch and so on..........