How to automate to enter data into textfields which textfield gets created ontime, like after I select the item from dropdown list , then multiple textfields got creted on time , sometimes 3 or 4 ro 7 textfields, How do i enter data into these fields .
Thank You
Data enter into dynamic textfield
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Data enter into dynamic textfield
Hello,
In order to get all your generated textfields you could use the 'FindDescendants' method as shown in the code below. Please use your specific Ranorex.Adapter (instead of InputTag) and your repository.
Markus (T)
In order to get all your generated textfields you could use the 'FindDescendants' method as shown in the code below. Please use your specific Ranorex.Adapter (instead of InputTag) and your repository.
// get a list of all InputTags IList<Ranorex.InputTag> inputTags = repo.RanorexTestPage.Self.FindDescendants<Ranorex.InputTag>(); // iterate over the list foreach (Ranorex.InputTag inputTag in inputTags) { inputTag.Value = "YourValue"; }Regards,
Markus (T)
Re: Data enter into dynamic textfield
Thank you MArkus, this method does "YourValue" to all textField on the page, how do I enter different value on each textField instead of hardocded "YourValue"
// iterate over the list
// iterate over the list
Code: Select all
public void GetInputTxtField()
{
// get a list of all InputTags
IList<Ranorex.InputTag> inputTags = repo.TCSF.RKCom.Csf1.FindDescendants<Ranorex.InputTag>();
// iterate over the list
foreach (Ranorex.InputTag inputTag in inputTags)
{
if (inputTag.Name=="csfID")
{
//donothing
}
else if(inputTag.Name=="poTrackingID")
{
break;//exit from the loop
}
else
{
inputTag.Value = "YourValue"; //how do I enter different value on each field instead of hardcoded
}
}
}
Tipu
Re: Data enter into dynamic textfield
i could use switch statment but then control name might change on second test iteration
Tipu
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Data enter into dynamic textfield
Hello,
You could use an IF or SWITCH-statement but you would need a unique identfier which uniquely identifies your InputTag. This could be done with a specific property (e.g. control name) or a specific RxPath.
Regards,
Markus (T)
You could use an IF or SWITCH-statement but you would need a unique identfier which uniquely identifies your InputTag. This could be done with a specific property (e.g. control name) or a specific RxPath.
Regards,
Markus (T)
Re: Data enter into dynamic textfield
I can use if or swithc statement but the problem with control name which gets created on time w/date and time stamp.
Tipu
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Data enter into dynamic textfield
Hello,
You would need something unique for your elements.
This could be a property like size or height e.g.
As soon as you have found such a unique property you could use it to enter values into your dynamic textfields.
Regards,
Markus (T)
You would need something unique for your elements.
This could be a property like size or height e.g.
As soon as you have found such a unique property you could use it to enter values into your dynamic textfields.
Regards,
Markus (T)