How to choose a different UI Element dynamically inside For Each UI Element

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.

Wanted process is as follows:

  1. Click “edit” button to make the form editable
  2. 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
  3. Move on to the next row until all elements are looped through
  4. 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?

This is how far I got with my automatization:

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.

@ava1

Welcome to the community

  1. use for eqch ui element and indicate whole row and include a filter for sat and sun in value
  2. 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
  3. Returned value can be used to write in type into

Cheers

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. :thinking:

@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…)

@ava1

Find children will return a lsit of ui elements each which matches you need to sue a loop and then currentelement as input in the input element field

Coming to skipping sun and sat …filter in for each ui element can be used and also if condition can be used after find chuldren if you want

Cheers