You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing issues while sending Keys to the custom date field via Selenium.
I'm using a Work Around to send fields into the custom date format.. It does not work any other Way!
This works on ALL browsers but facing Intermittent failures using Safari.
The Algo is..
Split DD/MM/YYYY into Arr = [DD MM YYYY]
Send 'a'
Send the ith element of Arr[]
Repeat 2 and 3.
Below is the Code snippet just to send date Keys.
public boolean sendDateKeys(By locator,String date, String msg1, String id, int index ) throws IOException{ //This is browser Sensitive
String msg2 = "Entered";
DebugPauseAfterStep();
String dob;
String srcFormat = "mm/dd/yy" ;
String dstFormat_all = "dd/mm/yyyy";
String elemDob = UtilFunctions.get().getAngVar(id);
System.out.println("the current date is "+ elemDob);
dob = UtilFunctions.convertDateFormat(date , srcFormat, dstFormat_all);
System.out.println("the converted date is "+ dob);
dob = UtilFunctions.convertDateFormat(CL.getTestDataInstance().getDOB(), srcFormat, dstFormat_all);
WebDriver wd = CL.GetDriver();
try {
UtilFunctions.sleepFor(1,"safari date field"); //TODO better is wait for value to be found..
wd.findElement(locator).sendKeys("a");
String currBoxVal = getAngVar(id);
System.out.println(String.format("the target is %s and orignal is %s", dob, currBoxVal));
int i = 0 ;
for (String s : dob.split("/")){
wd.findElement(locator).sendKeys(s);
if (isSafari()){
DebugPauseAfterStep();
wd.findElement(locator).sendKeys("a");
}
wd.findElement(locator).sendKeys("a");
i++;
}
myReport("Pass", msg1 + " " + msg2 + " Value is:"+ b(dob));
// UtilFunctions.get().sendKeys(locator, s, "Date of Birth", "Entered");
return true;
}catch(Exception e){
myReport("Fail", msg1 + " NOT" + msg2 + " Value is:" + b(dob) );
e.printStackTrace();
return false;
}
}
The text was updated successfully, but these errors were encountered:
I'm facing issues while sending Keys to the custom date field via Selenium.
I'm using a Work Around to send fields into the custom date format.. It does not work any other Way!
This works on ALL browsers but facing Intermittent failures using Safari.
The Algo is..
Below is the Code snippet just to send date Keys.
public boolean sendDateKeys(By locator,String date, String msg1, String id, int index ) throws IOException{ //This is browser Sensitive
The text was updated successfully, but these errors were encountered: