Issue in selecting time from android time picker


#1

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


#2

@shashikumarraja try to change:

@content-desc -> @contentDescription


#3

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


#4

@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).


#5

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


#6

You can use the below code with xpath.

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


#7

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