I had created a gloabl variable in profile with ‘Value Type’ as Number and assigned it a number , let say 15.
I am trying to executeg scripts through console mode and wish to override this global parameter value with number 3 and for this I am using argument as
-g_timeToWaitForElement=3
I am using this variable whenever I am calling waitForElementVisible or waitForElementPresent methods.
But, during script execution, an error occurred whenever the above mentioned ketword executed because it is interpreting ‘3’ as string not a number and throws an error like
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.waitForElementPresent() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.String)
Question is, if passing a number to global variable like -g_timeToWaitForElement=3 is not correct way then how I can do this without error?
i think this is a known issue still ignored.
as far as i remember this happens at least with data driven testing, e.g binding a variable which apparently is a valid number from the point of a sql select, katalon pass it as a string.
same may happen when overriding a certain global variable at runtime through cli options.
this has to be explored a bit.
my two cents, it is a valid bug, the cli just pick up whatever value passed to certain option as string, being unaware of the data type expected.
therefore the lazzy approach, no validation implemented.
in the meantime, the workaround proposed by @Russ_Thomas should work.
Thanks for the solution but now I need to do lot more work to replace GlobalVariable.timeToWaitForElement with GlobalVariable.timeToWaitForElement.toString().toInteger() in around 100 scripts