Hi, complete beginner here.
Sorry for the wordy post, tried to make it as clear as possible.
I am trying to automate filling a simple web form to have 08:30 written in every writable field, if the date field is not Saturday or Sunday.
However, I don’t know how to dynamically indicate both fields using For Each UI Element.
Use “For each UI element” → choose writable fields → they become the Current Element 3. Use Get Text on the date field → check if the text contains “Sat” or “Sun” 5. If it contains “Sat” or “Sun”, move on to the next field 6. If it does not contain “Sat” or “Sun”, write “08:30” in the Current Element field
Move on to the next row until all elements are looped through
Click the Save button
How can I loop through both the writable fields (Current Element) AND through the date fields?
Right now, I can use Current Element to write 08:30 in each writable field, but I can’t figure out how to Get Text from each corresponding date field as well. (It fills in 08:30 for each writable field, but Get Text only gets the first date field, so I can’t check if it says Sat or Sun)
The positions of the fields don’t change, but the date and field don’t seem to be linked on the table itself, so Creating a Label in the Get Current UI Element does not work.
How do I interate through both fields to create the If statement?
You can use the “Find Children” activity to search for child elements of a parent element. For example, if you have a parent “Div”, each of its child elements can be iterated over. The result of this activity is an IEnumerable containing selectors for each child element, which you can then loop through.
use for eqch ui element and indicate whole row and include a filter for sat and sun in value
Now inside the loop use find children and use filter as <tag='input />’ as that is the only one where data can be entered…make sure to select desendants in properties
Sorry for the slow reply as I can only work on this a few hours per week.
@Javier_Diaz
Thank you for your reply. I changed to UiStudio to be able to use Find Children, although I must figure out how it works in this particular case as I am already iterating through one list found using the For Each UI Element and need to find the “child” of the current item, instead of iterating through all children at once.
@Anil_G
Thank you for your reply also!
I tried adding the filter and then “Find Children” with <tag = ‘input’ > as the filter, and chose Find Descendants for Scope.
However, for Type Into, I’m not sure how to set the Target as the Input field as it only accepts TargetAnchorable (choosing an UI element on the screen).
For clarification, I’d like to skip over Sun/Sat on the date fields, which I think I can do using your filter suggestion, and then write 08:30 to the input field that is to the right of the Date field.
(Maybe I’ll need to study some easier problems before this one, but I’ll be slowly tweaking…)