Cannot select date from DatePicker Dialog Android

Hi @maina.eric,

Here’s a couple more things we could try:

Another try at MobileBuiltInKeywords.sendKeys()

In your test, make sure you tap on the text field for the date. Then try to use MobileBuiltInKeywords.sendKeys("06/04/2019") to see if it changes the date in the field. You might need to play around with the text a bit in case it breaks on the “/”.

Log what’s on the screen

I’m curious what Katalon and Appium think are on the screen at the time the date dropdown is open. If you want to see some more detail about exactly what Appium/Katalon detects on the screen you can log out the XML contents of the screen. You should be able to do that by putting the following import statements at the top of your test case:

import com.kms.katalon.core.logging.KeywordLogger
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.AppiumDriver

Then in the code for your test, add the following right after you drop down the date picker:

AppiumDriver<?> driver = MobileDriverFactory.getDriver()
KeywordLogger log = new KeywordLogger()
log.logInfo(driver.getPageSource())

When the test runs, you should see an entry in the Log Viewer for “Statement - log.logInfo(driver.getPageSource())” that shows the start of the XML for the screen. If you tap on it, you’ll see all of the XML for the screen on the right-hand pane.

If you could attach that XML in a reply that would be helpful for troubleshooting.

It would also be very helpful if you could share your Katalon test script code.

Using a third party library to work with the drop-down

Drop-downs in mobile testing are tricky, so I created an open source library to do a lot of the work for us.

You could try setting the drop-down value using this utility, specifically the Using a TextField with a Picker List section.

In this way, you could set the value of the text field with something like:

TextField.selectOption(dateToField, ['September', '12', '2019'], '9/12/2019', timeout)

For info on how to add the library to your Katalon project, see “Installation”.

Hope this helps,

Chris