Hi,
I would like to set a date from a calendar:

Since it’s difficult for me to type the date into textbox, so I chose to use a custom keword that I’ve found in a topic:
public class DatepickerHandler { @Keyword public static void handleDatepicker(TestObject calender, String exp_Date, String exp_Month, String exp_Year)throws Exception{
...
In the test Case, I call my keyword:
CustomKeywords.'com.ea.utilities.CommonUtilities.handleDatepicker'(findTestObject('Parametrage/Famille/Calendar'), '15', '05', '2018')
I got this error:
No signature of method: com.ea.utilities.CommonUtilities.handleDatepicker() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.Integer, java.lang.Integer, java.lang.Integer) values: [TestObject - ‘Object Repository/Parametrage/Famille/Calendar’, …]
Can anyone help me to resolve this problem please.
Thanks.
calendar.PNG
The error is saying you’re calling the method using a TestObject and three integers, yet your code you posted seems to be passing strings.
Make certain you’re passing actual strings and it should work (at least, from what I can tell from what you posted).
These are my 3 objects:
findTestObject('Parametrage/Famille/Calendar'), '15', '05', '2018'
The first one is a test Object, and the others are between quotes, so they are String
I can’t believe I’m suggesting you try this but…
Try double quotes.
And if that works, I want to know from a Groovy guru (if there’s one reading), why are constant strings (single quotes) being cast/coerced to ints.
Because, if true, that’s bad.
Thanks, I tried double quotes but I still get the same error.
CustomKeywords.'com.ea.utilities.CommonUtilities.handleDatepicker'(findTestObject('Parametrage/Famille/Calendar'), "15", "05", "2018")
One last thing (and btw, this should NOT work), try actually passing numbers… you SHOULD get the exact same error. Right?
Then, try this (and I agree, this is complete madness):
CustomKeywords.'com.ea.utilities.CommonUtilities.handleDatepicker'(findTestObject('Parametrage/Famille/Calendar'), (String) 15, (String) 5, (String) 2018)
Hope someone steps in and tells us what we’re missing… has to be something we’re not getting.
Thanks, but it doesn’t work. In this page, you can find the keyword’s code, if you or someone else could test:
https://paste.ofcode.org/8UhHYtwcJnN3sf7ymFZKif
I found this code in a topic and I want to use it in my test case.
You’re calling
CustomKeywords.‘com.ea.utilities.CommonUtilities.handleDatepicker’
Are you sure it’s not meant to be
CustomKeywords.‘com.ea.utilities.DatepickerHandler.handleDatepicker’
Wijdane said:
Thanks, but it doesn’t work. In this page, you can find the keyword’s code, if you or someone else could test:
https://paste.ofcode.org/8UhHYtwcJnN3sf7ymFZKif
I found this code in a topic and I want to use it in my test case.
Hi,
Given link is not working, can you please provide another link for the how to handle date from the calendar. In my case, I need to select a random date from the calendar