New here and need some advice if you would be so kind.
So I am getting the hang of automation testing and am attempting to automate the registration process by providing an excel CSV and have the program pull and play into the fields. All works well except for the DOB field. It seems the text selenium tries to insert, only gets inserted into the Year field. (If I send sendKeys("2020-01-01")
only DD-MM-2020 get entered. It seems the DOB element is all tied together (the month, day, and year fields are all one element) and I am stumped on how I would be able to automate this portion using Selenium Java.
You can find the DOB field on https://www.demo.guru99.com/V4/manager/addcustomerpage.php
Here is the code from inspector
<td><input type="date" name="dob" id="dob" onkeyup="validatedob();" onblur="validatedob();">
<label id="message24" style="visibility: visible;">Date Field must not be blank</label>
</td>
In a lame effort, I was curious as to how selenium recorder handled this so I recorded the same scenario and the script it writes works in Selenium Recorder but not when it is exported to Junit script.
Selenium Recorder generated script for DOB field:
driver.findElement(By.id("dob")).click();
driver.findElement(By.id("dob")).sendKeys("0002-01-01");
driver.findElement(By.id("dob")).sendKeys("0020-01-01");
driver.findElement(By.id("dob")).sendKeys("0200-01-01");
driver.findElement(By.id("dob")).sendKeys("2020-01-01");
Pasting this code into the java program yields the same mm-dd-2020.
I DO NOT want to use the calendar to input the date as I suspect that would be a pain.
Appreciate any help, Andy