Instead of key sequence how to use system date in DD/MM/YYYY format to pass for every scenario.
repo path for element
Testcase code when converted key sequence into code
public void Key_sequence_ApplicationDate(RepoItemInfo inputtagInfo)
{
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '04/07/2021' with focus on 'inputtagInfo'.", inputtagInfo);
inputtagInfo.FindAdapter<InputTag>().PressKeys("04/07/2021");
}
repo path of element
?/?/form[@id='undefined']/tag[2]/tag[@tagname='row']/div/tag[@tagname='dynamic-control']/tag[@tagname='ng-component']/div/div/div/input[@id='applicationDate']
locked code
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '04/07/2021' with focus on 'FairwayBrokerPortal.ModalBodyTextCenter1.ApplicationDate'.", repo.testurlPortal.ModalBodyTextCenter1.ApplicationDateInfo, new RecordItemIndex(49));
repo.userportalPortal.ModalBodyTextCenter1.ApplicationDate.PressKeys("04/07/2021");
Delay.Milliseconds(0);
And how to get immediate response or online support for licensed users ? We have two currently Floating
How to add system date or future date on ui pop up instead of key sequence
How to add system date or future date on ui pop up instead of key sequence
Last edited by gsb on Thu Jun 17, 2021 10:12 pm, edited 1 time in total.
Re: How to add system date on ui pop up instead of key sequence
Hi,
If I understand correctly you are looking to auto fill you date selection use system time. To do this we will write a simple coded action to place today's date in the correct format using the code below.
public void GetTime()
{
System.DateTime dt = System.DateTime.Today;
string date = String.Format("{0:MM/dd/yyyy}", dt);
repo.TestWebApplicatio.datefield.PressKeys(date);
}
Hope this helps!
Cheers,
Mike
If I understand correctly you are looking to auto fill you date selection use system time. To do this we will write a simple coded action to place today's date in the correct format using the code below.
public void GetTime()
{
System.DateTime dt = System.DateTime.Today;
string date = String.Format("{0:MM/dd/yyyy}", dt);
repo.TestWebApplicatio.datefield.PressKeys(date);
}
Hope this helps!
Cheers,
Mike
Re: How to add system date on ui pop up instead of key sequence
yes Mike you understand it correctly
Since my test only works on today date
If you please also tell me where to write this code have shared everything here..
oh got it !! need to Map the user code with newly created GetTime() function ?
seems it works (added.jpg file)
Thanks
BTW what does this code do ?
string date = String.Format("{0:MM/dd/yyyy}", dt)
Since my test only works on today date
If you please also tell me where to write this code have shared everything here..
oh got it !! need to Map the user code with newly created GetTime() function ?
seems it works (added.jpg file)
Thanks
BTW what does this code do ?
string date = String.Format("{0:MM/dd/yyyy}", dt)
You do not have the required permissions to view the files attached to this post.
Re: How to add system date on ui pop up instead of key sequence
Hi there,
My apologizes for not explaining this very well but I am glad to hear you were able to easily decipher what I was trying to say
This code is taking the System.Date value and converting to the format we need and then saves it to a String data type which is what Ranorex needs.
//Create a variable to hold today's date
System.DateTime dt = System.DateTime.Today;
//Format the date variable in MM/dd/yyyy format and save it to a String variable.
string date = String.Format("{0:MM/dd/yyyy}", dt);
Hope this helps!
Cheers,
Mike
My apologizes for not explaining this very well but I am glad to hear you were able to easily decipher what I was trying to say
This code is taking the System.Date value and converting to the format we need and then saves it to a String data type which is what Ranorex needs.
//Create a variable to hold today's date
System.DateTime dt = System.DateTime.Today;
//Format the date variable in MM/dd/yyyy format and save it to a String variable.
string date = String.Format("{0:MM/dd/yyyy}", dt);
Hope this helps!
Cheers,
Mike
Re: How to add system date on ui pop up instead of key sequence
Np Prob Bro, Many Thanks for explaining . Thank you
Just another query how add particular date in same code Like previous and current employment Start and End date
public void Empdate()
{
System.DateTime dt = System.DateTime.Today;
string date = String.Format("{0:MM/dd/yyyy}", dt);
repo.TestWebApplicatio.datefield.PressKeys(date);
}
Thanks Mike
Just another query how add particular date in same code Like previous and current employment Start and End date
public void Empdate()
{
System.DateTime dt = System.DateTime.Today;
string date = String.Format("{0:MM/dd/yyyy}", dt);
repo.TestWebApplicatio.datefield.PressKeys(date);
}
Thanks Mike
Re: How to add system date on ui pop up instead of key sequence
Something like this will give you previous date or future date
System.DateTime dt = System.DateTime.Today-7; //This would give you last week
System.DateTime dt = System.DateTime.Today+7; //Will give you next week
It is really up to you to determine how you want to calculate past and future dates.
Cheers,
Mike
System.DateTime dt = System.DateTime.Today-7; //This would give you last week
System.DateTime dt = System.DateTime.Today+7; //Will give you next week
It is really up to you to determine how you want to calculate past and future dates.
Cheers,
Mike
Re: How to add system date on ui pop up instead of key sequence
Hi @Support team
With extended date code am getting Error
With extended date code am getting Error
Operator '+' cannot be applied to operands of type 'DateTime' and 'int' (CS0019)System.DateTime dt = System.DateTime.Today+7;
Re: How to add system date on ui pop up instead of key sequence
No Error with Adddays
System.DateTime.Today.AddDays(7);
Re: How to add system date on ui pop up instead of key sequence
That's a coding error against the .NET Framework - you'll want to consult the MSDN documentation on that API to find out how to use it correctly.
Re: How to add system date on ui pop up instead of key sequence
@Support team @stub All Geeks
This also gives me today's date. Not adding next 15 DaysSystem.DateTime.Today.AddDays(7);
Code: Select all
System.DateTime fdt = System.DateTime.Today.AddDays(15);
string date = String.Format("{0:MM/dd/yyyy}", fdt);
Re: How to add system date or future date on ui pop up instead of key sequence
i was also searching for the same thing