Issue in selecting time from android time picker

Using javascript binding of appium
I am trying to select the time from time picker using the xpath as follows(selecting 1 in this case):

await driver.waitForElementByXPath("//android.widget.RadialTimePickerView$RadialPickerTouchHelper[contains(@content-desc,'1')]", asserters.isDisplayed, 10000).click();

But getting error -
[waitForElementByXPath("//android.widget.RadialTimePickerView$RadialPickerTouchHelper[contains(@content-desc,'1')]",{},10000)] [elements("xpath","//android.widget.RadialTimePickerView$RadialPickerTouchHelper[contains(@content-desc,'1')]")] Error response status: 32, , InvalidSelector - Argument was an invalid selector (e.g. XPath/CSS). Selenium error: Argument was an invalid selector (e.g. XPath/CSS).

1 Like

@shashikumarraja try to change:

@content-desc -> @contentDescription

@Aleksei I have used @content-desc at many places in my code and it works fine

@Aleksei tried @contentDescription and got the same error-

[waitForElementByXPath("//android.widget.RadialTimePickerView$RadialPickerTouchHelper[contains(@contentDescription,'2')]",{},10000)] [elements("xpath","//android.widget.RadialTimePickerView$RadialPickerTouchHelper[contains(@contentDescription,'2')]")] Error response status: 32, , InvalidSelector - Argument was an invalid selector (e.g. XPath/CSS). Selenium error: Argument was an invalid selector (e.g. XPath/CSS).

this is problematic for xPath. try to see same your pageSource and check is it “android.widget.RadialTimePickerView$RadialPickerTouchHelper” or maybe “android.widget.RadialTimePickerView” ?

You can use the below code with xpath.

driver.findElement(By.xpath("//*[@content-desc=‘5’]"));

Did you find any solution for this. I’m facing same problem

can u help me for this time picker

Have anyone got solution? Please provide solutions