Your code almost works. You only need to make sure you the get n-th instance of an element with xpath and not only the 1st. Tthis should work:
- First instance:
//*[contains(@id,“duedate_day”)][1] - Second instance:
//*[contains(@id,“duedate_day”)][2] - Third instance:
//*[contains(@id,“duedate_day”)][3] - …
In general //somexpression[N] means “Find every node selected by //somexpression that is the N th child of its parent”.
So in the while loop you can use
//*[contains(@id,“duedate_day”)][${myIndex}]
and then increase the ${myIndex} with every loop with storeEval
{
"Command": "storeEval",
"Target": "${myIndex}+1 ",
"Value": "myIndex"
},
The storeEval idea is from this post.