Cannot get current time from IOS date picker

IOS simulator iPhone 11
IOS 14.5
Katalon Studio 8.0.5

Hi,

I cannot get the current time from the IOS date picker below. I have tried different locator strategies (some pass but the ones that do pass always return the string “Today”). Also, some locator strategies simply fail the test. Please see below the script and screenshot of the IOS date picker.

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable

import java.time.LocalDateTime
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.util.regex.Matcher
import java.util.regex.Pattern

String username = GlobalVariable.username
String password = GlobalVariable.password
String locatorService = GlobalVariable.locatorservice
String appPath = GlobalVariable.iosAppLocation

TestObject cameraThumb = GlobalVariable.cameraThumbIOS

Mobile.startApplication(appPath, true) //Setting this to true means that the app is uninstalled after the run, so previous states won’t be saved
‘Login using custom function’
CustomKeywords.‘stratocast.MMXX_Utilities.loginIOS’(username,password,locatorService)

Mobile.comment("—Tap on Camera Name to access camera—")
Mobile.tap(cameraThumb,10)

sleep(3000)
Mobile.comment("—Tap on Seek and adjust time -1 minute to initiate Playback (Takes a long time, don’t worry)—")
//try { //This try block is unbelievably slow
Mobile.tap(findTestObject(‘Object Repository/Login Screen/IOS/XCUIElementTypeStaticText - Seek’),10) //Tap Seek

Mobile.comment("—Verifying that the date picker (seek dialogue) can be seen—")
Mobile.verifyElementExist(findTestObject(‘Object Repository/Login Screen/IOS/XCUIElementTypeDatePicker’),10)
Mobile.tap(findTestObject(‘Object Repository/Login Screen/IOS/XCUIElementTypeStaticText - Seek OK’),10) //Tap OK on seek to get to time on same date

String currentMin = Mobile.getText(findTestObject(‘Object Repository/Login Screen/IOS/XCUIElementTypePickerWheel - PM (1)’),10) //Get current time
Mobile.comment("CURRENT MIN = " + currentMin)

***NOTE: currentMin shows “Today” no matter what object I use to pass and what locator strategy.

Just curious, why are you using type to identify the element instead of xpath? In your image, you only have type checked to “Detect object by?”. What happens when you uncheck type and check xpath?

Using the XPATH instead, current Min is set to “PM”. Not exactly the value Im looking for.

e[35m[HTTP]e[39m e[90m{“using”:“xpath”,“value”:"//XCUIElementTypeApplication/XCUIElementTypeWindow[3]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeDatePicker[1]/XCUIElementTypePicker[1]/XCUIElementTypePickerWheel[4]"}e[39m
2021-07-15 17:32:37.788 DEBUG HHMMSS with timezone abbreviation (724) - 17: comment("CURRENT MIN = " + currentMin)
2021-07-15 17:32:37.790 INFO c.k.k.c.keyword.builtin.CommentKeyword - CURRENT MIN = PM

image

fyi, I changed the last index from 4 to 3, and now I’m getting 41 minutes. Which is what I’m looking for.

And if you change the last index to 2 you should get the hour.

Haven’t tried that yet but most likely. One thing that I am trying to do with this window is scroll to any minute before or after the currently selected minute which is the current time.
I have obtained the current minute as shown below.

String currentMin = Mobile.getText(findTestObject(‘Object Repository/Login Screen/IOS/XCUIElementTypePickerWheel - PM (1)’),10) //Get current time

Mobile.comment("CURRENT MIN = " + currentMin)

currentMin = currentMin.substring(0,2)

//currentMin = Integer.parseInt(currentMin) - 1 //Go back 1 minute. Integer.parseInt() converts a string into an int

//Mobile.comment("NEW CURRENT MIN = " + currentMin)

//if (Integer.parseInt(currentMin) < 1) //Make sure no negative time!

// currentMin = 0

if (Integer.parseInt(currentMin) < 1) //Make sure no negative time!

currentMin = 0

//sleep(5000)

Mobile.comment("—Setting Minute—")

Mobile.scrollToText(currentMin-1)

===========================

I get the following error below.

=============== ROOT CAUSE =====================

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html

================================================

07-18-2021 02:40:04 PM scrollToText(currentMin - 1)

Elapsed time: 32.581s

Unable to scroll to text ‘39’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Text ‘39’ not found.

at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)

at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)

at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain$stepFailed$0.call(Unknown Source)

at com.kms.katalon.core.mobile.keyword.builtin.ScrollToTextKeyword$_scrollToText_closure1.doCall(ScrollToTextKeyword.groovy:80)

at com.kms.katalon.core.mobile.keyword.builtin.ScrollToTextKeyword$_scrollToText_closure1.doCall(ScrollToTextKeyword.groovy)

at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)

at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain$runKeyword.call(Unknown Source)

at com.kms.katalon.core.mobile.keyword.builtin.ScrollToTextKeyword.scrollToText(ScrollToTextKeyword.groovy:85)

at com.kms.katalon.core.mobile.keyword.builtin.ScrollToTextKeyword.execute(ScrollToTextKeyword.groovy:41)

at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)

at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.scrollToText(MobileBuiltInKeywords.groovy:1829)

at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$scrollToText$7.call(Unknown Source)

at Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724).run(Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724):62)

at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)

at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)

at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:369)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:360)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:339)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:331)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:248)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)

at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)

at TempTestCase1626633462080.run(TempTestCase1626633462080.groovy:25)

)

image

The below link suggests you should try sendKeys instead of scrollToText. It states that the OP of that question can use sendKeys “to [successfully] select date, time, minutes, and AM/PM from the control” (but he couldn’t change the actual date which is what he was concerned about). Something to try.

Also an excellent explanation of the control at the bottom of the post.

The data type of the parameter for scrollToText is to be a String and you have, Mobile.scrollToText(currentMin-1). I don’t think the parameter you have would be considered a String.

Perhaps also you could look at the above and review currentMin as it is a String, not an Integer.

//Make sure no negative time!    
if (Integer.parseInt(currentMin) < 1) {

    currentMin = '0'    // or you could have `currentMin = 0.toString()`

} else {

    currentMin = (Integer.parseInt(currentMin) - 1).toString()
}

and then just use

Mobile.scrollToText(currentMin)

I used sendKeys and it worked. I was able to select the minutes. However I ran into another issue. Once I select the minutes and tap ‘Seek’ button from the UI, It then shows me the timestamp on another window. My script wants to validate the timestamp, however I cannot do a capture on that object. I get the following error.

java.lang.reflect.InvocationTargetException

at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:397)

at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:469)

at com.kms.katalon.composer.mobile.objectspy.dialog.MobileObjectSpyDialog.captureMobileElement(MobileObjectSpyDialog.java:841)

at com.kms.katalon.composer.mobile.objectspy.composites.MobileAllObjectsWithCheckboxComposite$3.checkStateChanged(MobileAllObjectsWithCheckboxComposite.java:101)

at org.eclipse.jface.viewers.CheckboxTreeViewer$1.run(CheckboxTreeViewer.java:168)

at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)

at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)

at org.eclipse.jface.viewers.CheckboxTreeViewer.fireCheckStateChanged(CheckboxTreeViewer.java:165)

at org.eclipse.jface.viewers.CheckboxTreeViewer.handleSelect(CheckboxTreeViewer.java:295)

at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1207)

at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:242)

at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:237)

at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:402)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)

at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4385)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)

at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3789)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1158)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1047)

at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)

at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)

at com.kms.katalon.core.application.WorkbenchApplicationStarter.start(WorkbenchApplicationStarter.java:23)

at com.kms.katalon.application.Application.runGUI(Application.java:191)

at com.kms.katalon.application.Application.start(Application.java:102)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)

at org.eclipse.equinox.launcher.Main.run(Main.java:1447)

Caused by: org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.

For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html

Build info: version: ‘unknown’, revision: ‘unknown’, time: ‘unknown’

System info: host: ‘MGRANDILLO-MAC.local’, ip: ‘fe80:0:0:0:1451:e664:136:e659%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.16’, java.version: ‘1.8.0_275’

Driver info: io.appium.java_client.ios.IOSDriver

Capabilities {app: /Users/MGrandillo/Downloads…, appWaitActivity: *, automationName: XCUITest, browserName: , chromedriverPort: 49898, databaseEnabled: false, deviceId: 39E74616-FFA4-40A9-BA1D-0B2…, deviceName: iPhone 11, fullReset: false, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 1800, noReset: true, platform: MAC, platformName: iOS, platformVersion: 14.5, realDeviceLogger: /Applications/Katalon Studi…, takesScreenshot: true, udid: 39E74616-FFA4-40A9-BA1D-0B2…, waitForAppScript: true;, wdaLocalPort: 49901, webStorageEnabled: false}

Session ID: 22600cb8-4409-4dc8-94db-ee316260499a

*** Element info: {Using=xpath, value=//*[@type = ‘XCUIElementTypeStaticText’ and @label = ‘Jul. 19 8:39:02 PM UTC’ and @name = ‘Jul. 19 8:39:02 PM UTC’]}

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)

at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)

at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)

at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)

at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)

at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)

at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)

at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)

at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)

at io.appium.java_client.ios.IOSDriver.findElement(IOSDriver.java:1)

at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)

at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:152)

at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)

at io.appium.java_client.ios.IOSDriver.findElementByXPath(IOSDriver.java:1)

at com.kms.katalon.composer.mobile.objectspy.element.impl.IosXCUISnapshotMobileElement.buildLocator(IosXCUISnapshotMobileElement.java:140)

at com.kms.katalon.composer.mobile.objectspy.element.impl.RenderedTreeSnapshotMobileElement.newCapturedElement(RenderedTreeSnapshotMobileElement.java:104)

at com.kms.katalon.composer.mobile.objectspy.dialog.MobileObjectSpyDialog$9.run(MobileObjectSpyDialog.java:847)

at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

image

The two main lines that I see are above. Looking at the element’s xpath, it looks like a specific date and time (which would only occur once a year). That could be why the “element” is not found. You will need to (manually) create an xpath that describes the element’s location less specific than you currently have. What about trying:

//*[@type = 'XCUIElementTypeStaticText']

As for comparing the date, you should look into concatenating (adding Strings together) the Date, Hour, Minute, etc array bits together into an actual date format. See what it gives you anyway.
Note: you may have to resort to RegEx to do a comparison of the seconds.

You mean putting //*[@type = ‘XCUIElementTypeStaticText’]
within my script? This adds a comment in the script because of the //

What is the correct syntax? Thanks.

fyi, I got the following error with the code below.

2021-07-20 09:13:20.983 DEBUG HHMMSS with timezone abbreviation (724) - 26: comment("—Checking if timestamp contains two colons (HH:MM:SS) and timezone abbreviation (UTC/GMT)—")
2021-07-20 09:13:21.015 INFO c.k.k.c.keyword.builtin.CommentKeyword - —Checking if timestamp contains two colons (HH:MM:SS) and timezone abbreviation (UTC/GMT)—
2021-07-20 09:13:21.017 DEBUG HHMMSS with timezone abbreviation (724) - 27: xpath = “//[@type = ‘XCUIElementTypeStaticText’]"
2021-07-20 09:13:21.018 DEBUG HHMMSS with timezone abbreviation (724) - 28: time = getText(findTestObject("//
[@type = ‘XCUIElementTypeStaticText’]”), 10)
2021-07-20 09:13:21.021 WARN c.k.k.core.testobject.ObjectRepository - Test object with id ‘Object Repository///*[@type = ‘XCUIElementTypeStaticText’]’ does not exist
2021-07-20 09:13:21.064 WARN c.k.k.core.testobject.ObjectRepository - Test object with id ‘Object Repository/’ does not exist
2021-07-20 09:13:21.541 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Failed to get text from element (Root cause: java.lang.IllegalArgumentException: Object is null
at com.kms.katalon.core.helper.KeywordHelper.checkTestObjectParameter(KeywordHelper.java:33)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword$_getText_closure1.doCall(GetTextKeyword.groovy:70)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword$_getText_closure1.call(GetTextKeyword.groovy)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword.getText(GetTextKeyword.groovy:80)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword.execute(GetTextKeyword.groovy:64)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.getText(MobileBuiltInKeywords.groovy:1236)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$getText$6.call(Unknown Source)
at Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724).run(Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724):78)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:369)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:339)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:331)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:248)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1626786635504.run(TempTestCase1626786635504.groovy:25)
)
2021-07-20 09:13:21.547 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/IOS/Deliverables 1 and 2/Playback/Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724) FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Failed to get text from element (Root cause: java.lang.IllegalArgumentException: Object is null
at com.kms.katalon.core.helper.KeywordHelper.checkTestObjectParameter(KeywordHelper.java:33)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword$_getText_closure1.doCall(GetTextKeyword.groovy:70)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword$_getText_closure1.call(GetTextKeyword.groovy)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword.getText(GetTextKeyword.groovy:80)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword.execute(GetTextKeyword.groovy:64)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.getText(MobileBuiltInKeywords.groovy:1236)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$getText$6.call(Unknown Source)
at Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724).run(Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724):78)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:369)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:339)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:331)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:248)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1626786635504.run(TempTestCase1626786635504.groovy:25)
)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:23)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword.getText(GetTextKeyword.groovy:80)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword.execute(GetTextKeyword.groovy:64)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.getText(MobileBuiltInKeywords.groovy:1236)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$getText$6.call(Unknown Source)
at Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724).run(Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724):78)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:369)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:339)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:331)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:248)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1626786635504.run(TempTestCase1626786635504.groovy:25)
Caused by: java.lang.IllegalArgumentException: Object is null
at com.kms.katalon.core.helper.KeywordHelper.checkTestObjectParameter(KeywordHelper.java:33)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword$_getText_closure1.doCall(GetTextKeyword.groovy:70)
at com.kms.katalon.core.mobile.keyword.builtin.GetTextKeyword$_getText_closure1.call(GetTextKeyword.groovy)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
… 17 more

Mobile.comment("—Checking if timestamp contains two colons (HH:MM:SS) and timezone abbreviation (UTC/GMT)—")

xpath = “//*[@type = ‘XCUIElementTypeStaticText’]”

String time = Mobile.getText(findTestObject("//*[@type = ‘XCUIElementTypeStaticText’]"),10)

Mobile.comment("DATE AND TIME = " + time)

FYI, I tried to capture the same mobile element on Android and that worked. Why is it failing on IOS?

Also tried the code snippet below.
import com.kms.katalon.core.testobject.ConditionType

import com.kms.katalon.core.testobject.TestObject

TestObject myNewObject = new TestObject(“XCUIElementTypeStaticText”)

date = myNewObject.addProperty(“xpath”, ConditionType.EQUALS, “//*[@type = ‘XCUIElementTypeStaticText’]”)

Mobile.comment("DATE AND TIME = " + date)

======================================

Date returns:

2021-07-20 10:03:41.408 DEBUG HHMMSS with timezone abbreviation (724) - 26: comment("—Checking if timestamp contains two colons (HH:MM:SS) and timezone abbreviation (UTC/GMT)—")
2021-07-20 10:03:41.435 INFO c.k.k.c.keyword.builtin.CommentKeyword - —Checking if timestamp contains two colons (HH:MM:SS) and timezone abbreviation (UTC/GMT)—
2021-07-20 10:03:41.437 DEBUG HHMMSS with timezone abbreviation (724) - 27: myNewObject = new com.kms.katalon.core.testobject.TestObject(XCUIElementTypeStaticText)
2021-07-20 10:03:41.493 DEBUG HHMMSS with timezone abbreviation (724) - 28: date = myNewObject.addProperty(“xpath”, EQUALS, “//*[@type = ‘XCUIElementTypeStaticText’]”)
2021-07-20 10:03:41.512 DEBUG HHMMSS with timezone abbreviation (724) - 29: comment("DATE AND TIME = " + date)
2021-07-20 10:03:41.520 INFO c.k.k.c.keyword.builtin.CommentKeyword - DATE AND TIME = TestObject - 'XCUIElementTypeStaticText’
2021-07-20 10:03:41.522 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/IOS/Deliverables 1 and 2/Playback/Seek button visible and brings up dialogue, timestamp HHMMSS with timezone abbreviation (724)

In this case, you are getting confused with the Test Object element and the contents that the TO will have. When you do the below, you are currently using the Test Object.

Mobile.comment("DATE AND TIME = " + date)

You now need to get the Test Object’s content, like below.

String currentMin = Mobile.getText(myNewObject ,10)
Mobile.comment("DATE AND TIME = " + currentMin )

I changed my script as you mentioned but the returned text is not what I expect to see.

import com.kms.katalon.core.testobject.ConditionType

import com.kms.katalon.core.testobject.TestObject

TestObject myNewObject = new TestObject(“MyObjectName”)

date = myNewObject.addProperty(“xpath”, ConditionType.EQUALS, “//*[@type = ‘XCUIElementTypeStaticText’]”)

currentMin = Mobile.getText(date ,10)

Mobile.comment("DATE AND TIME = " + currentMin)

=======================================

2021-07-20 13:17:50.068 DEBUG HHMMSS with timezone abbreviation (724) - 30: comment("DATE AND TIME = " + currentMin)
2021-07-20 13:17:50.069 INFO c.k.k.c.keyword.builtin.CommentKeyword - DATE AND TIME = M3007-PV

Not quite like I had. See below:

Ok, I replaced the code as show below and still get DATE AND TIME = M3007-PV

import com.kms.katalon.core.testobject.ConditionType

import com.kms.katalon.core.testobject.TestObject

TestObject myNewObject = new TestObject(“MyObjectName”)

myNewObject.addProperty(“xpath”,ConditionType.EQUALS, “//*[@type = ‘XCUIElementTypeStaticText’]”)

currentMin = Mobile.getText(myNewObject ,10)

Mobile.comment("DATE AND TIME = " + currentMin)

@Chris_Trevarthen, @duyluong Can you assist?

Hi, I haven’t heard anyone comment regarding this issue. I have some test cases that are blocked for automation regarding this. You’re help and support is greatly appreciated. Let me know if there is any more information you would need on my end to proceed with this ticket. Thanks.