so I am working in a Testing Automation case where i should increment the index of my Xpath every time i run dhe test case. So far i have done this:
wd.addPromiseChainMethod("SelectAcc", () => {
var XPathIndex = I;
return driver.waitForElementByXpath(
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[" +
i +
"]"
);
if (XPathIndex > 5) {
I = 1;
} else {
I = XPathIndex + 1;
}
click();
});
and also globaly declared`
Var I =1;
But I am not sure how to update the global variable I, so for example if i have ran the test case 2 times, the third time I run it I will be:
Var I =3;