Let's say, a web page having multiple row items out of which we need to pull more than one value. Below is the solution in Leapwork.
Understanding the solution:
- Var b contains the collection of all table rows, i.e. <tr> elements in a table.
- The return statement i.e b.length returns the row count and it is available as an output parameter via the Result connector. This Result connector is connected to the maximum connector of the Loop block in order to define the number of times the iteration process should be executed.
- Once the values are returned from the array function, they are typecasted to string type for every 'i' th iteration so that the final result can be logged in using the "Log message" block.
- Once done with all of the iterations, the user may proceed with the next set of logic by triggering the 'Completed' (green) connector of the Loop block.
var a = document.querySelector("div#DeltaPlaceHolderMain
table.ms-v4propertysheetspacing tbody tr td table tbody:nth-child(2)
tr:nth-child(1) td:nth-child(4) table tbody");
var b = a.rows;
var obj = [name,num];
var i = arguments;
var display = b[i].querySelector("td:nth-child(1) input").checked;
if(display == true)
var name = b[i].querySelector("td:nth-child(3) label").textContent;
var pos = b[i].querySelector("td:nth-child(4) select option:checked").value;
var x= array(name,num);
var text = "";
text += x[i] + " ";
For any clarification, please contact our Priority Support.