Best way to dynamically iterate a set of repeating fields on a web page in Keyword Test
I'm developing a keyword test to property checkpoint some values on an Oracle Cloud web based application. The web form has two sections - header and details. The details section consists of one or more product item lines with product descriptions, quantities, prices, units of measure, the usual financial stuff.
I've created a data driven keyword test which successfully property checks the header values. I'm now trying to property check each of the item lines in a data driven loop.
The problem I'm hitting is that the individual fields are not arranged in any kind of table or grid as such. Instead they are all individual fields with dynamically generated at runtime with IDs such as:
ItemName1 QuantityX31 UoMX411
ItemName2 QuantityX32 UoMX412
ItemName3 QuantityX33 UoMX413
As far as I can see I have two choices:
* Create name mapping items for every possible field up to a maximum number of expected rows and use If...Exists to check the content if the field is available on the form
* Loop the data counting the row number, dynamically generate the field name using some kind of expression such as "ItemName" + RowNumber and then check the value
I've considered using name mapping wildcards such as ItemName* but that will not identify the field relating to my specific data loop.
My developer instincts say to use the second option but I have literally know idea how to actually implement it. Does anyone have any experience of this and could point me in the direction of an example or tutorial?
I've looked at Solved: Finding Elements on a Web Page - SmartBear Community which seems to partially solve my problem. However I can't use it directly because the web page I'm working with is not a fixed URL. It's actually the results of a "search" within the web app and so I can't issue a Browsers.Item(btChrome).Run() in the script.
Also ideally I'd like to keep the use of scripts to a minimum and, where scripts are needed, create a reusable script to return any textContent based on a "PageContent" and "XPath" pair of parameters.