31-05-24 06:36 PM
I'm leveraging a dynamic match type for a series of web input fields where I can not predict the total # of fields.
For instance, there at 3 input fields with a WebID of Field1, Field2, & Field3 -- sometimes there will be 1 field and upto 200.
I want to loop through each field using a dynamic match type on Web ID and validate if the field actually exists.
How can I determine if the App Modeller Element exists or not?
Answered! Go to Answer.
31-05-24 08:24 PM
If the fields are numbered consecutively and they appear in the page's HTML one after another, there is a couple of quick ways determine what is the current last field.
The way I would not recommend is create an element with the attributes of Match Reverse, with a Match Index of 1 and put a wildcard on the Web Id attribute (Field*).
The way I would recommend is create an element that uses an XPath expression the would give you the last element that matches those IDs:
(//input[starts-with(@id,'Field')])[last()]
With either method above, you can then use the Get ID action in a read stage to retrieve the ID of the that last element to parse out the number of fields.
31-05-24 08:24 PM
If the fields are numbered consecutively and they appear in the page's HTML one after another, there is a couple of quick ways determine what is the current last field.
The way I would not recommend is create an element with the attributes of Match Reverse, with a Match Index of 1 and put a wildcard on the Web Id attribute (Field*).
The way I would recommend is create an element that uses an XPath expression the would give you the last element that matches those IDs:
(//input[starts-with(@id,'Field')])[last()]
With either method above, you can then use the Get ID action in a read stage to retrieve the ID of the that last element to parse out the number of fields.
31-05-24 09:35 PM
Thank you -- it did not quite work but I love the idea and I will keep trying with this approach.