Unable to send Date to DOB


#1

I tried to pass date to DOB field. can you tell me what’s the format i should send date

feature file :

@tag
Feature: NewCustomer
Createnewcustomer

@tag1
Scenario: Test_01
Given I am in the guru home page
And I logged as a manager
| userName | password |
| mngr186730| mEdYvus |
When I navigate to new customer
| custName | addRess | city | dob | state | pinno | telephoneno | password |
| saman | test |Colombo | 12112013| Western| 123456 | 1234567 | Cat584851|
Then create a new customer successfully

Code : class NewCus {
/**
* The step definitions below match with Katalon sample Gherkin steps
*/
@Given(“I am in the guru home page”)
def I_am_in_the_guru_home_page() {
WebUI.openBrowser(“http://demo.guru99.com/v4/”);
}

@And("I logged as a manager")
def I_logged_as_a_manager(DataTable table) {
	List<Map<String, String>> data =table.asMaps(String.class, String.class);

	WebUI.setText(findTestObject('login/InputUserName'), data[0].userName);
	WebUI.setText(findTestObject('login/InputPassword'), data[0].password);
	WebUI.click(findTestObject('login/ButtonLogin'));
}

@When("I navigate to new customer")
def I_navigate_to_new_customer(DataTable table2) {
	
	WebUI.click(findTestObject('New Customer/NewCustomerlink'))
	List<Map<String, String>> data2 =table2.asMaps(String.class, String.class);
	WebUI.setText(findTestObject('New Customer/InputCustomerName'), data2[0].custName)
	WebUI.click(findTestObject('New Customer/InputGender'), FailureHandling.STOP_ON_FAILURE)
	WebUI.setText(findTestObject('New Customer/InputDOB'), data2[0].dob)
	WebUI.setText(findTestObject('New Customer/InputAddress'), data2[0].addRess)
	
	WebUI.setText(findTestObject('New Customer/InputCity'), data2[0].city)
	
	WebUI.setText(findTestObject('New Customer/InputState'), data2[0].state)
	
	WebUI.setText(findTestObject('New Customer/InputPin'), data2[0].pinno)
	
	WebUI.setText(findTestObject('New Customer/InputMobileNumber'), data2[0].telephoneno)
	String ts = System.currentTimeMillis().toString()
	
	WebUI.setText(findTestObject('New Customer/InputEmail'),  ts + "@test.com")
	WebUI.setText(findTestObject('New Customer/InputPassword'), data2[0].password)
	WebUI.waitForPageLoad(20, FailureHandling.STOP_ON_FAILURE)
	
	WebUI.click(findTestObject('New Customer/btnSubmit'))
	WebUI.delay(3)
	
	
}
@Then("create a new customer successfully")
def create_a_new_customer_successfully() {
}

}


#2

Are you getting an error? If it’s only a text field you should be able to pass any text.


#3

nop. i dont get any error.

this is the form : https://demo.guru99.com/v4/manager/addcustomerpage.php

username : mngr186730
password : mEdYvus


#4

Just pass in the string. But, try adding this before entering the date:

WebUI.setText(findTestObject('New Customer/InputDOB'), Keys.HOME)

so the cursor is set to the beginning of the DOB input field. See if it works. :man_shrugging: