How to increase the value of a field every time a selenium test is performed?

Is there any simple way to increment, for example, the value of the field by +1 every time the Selenium test is run through the Selenium IDE?

Command: Type Target: some kind of id Value: number+1 

EDIT 1 : Thanks for the answer from krosenvold. I got your idea, and this is a simplified version of what I have received so far:

 ... store | 10 | x storeEval | storedVars['x'] = ${x}+1 | ... 

The value of the x variable does increase, but how can you keep this value between separate test runs? is it even possible?

Should I get the value of $ x every time I run the test and at the end of it assign the value of $ x to some dummy element on the test page, so that I could get this previously increased value on the next time test?

+7
selenium
source share
4 answers

Correct answer

shop | 10 | I

shop | javascript {storedVars.i ++;} | I

echo | $ {R}

+5
source share

This is the solution for your problem.

 store | 10 | i store | javascript{storedVars.i++;} echo | ${i} 
+3
source share

You can use eval ;

 eval($('elementId').value = $('elementId').value +1); 

The exact syntax that I show implies a prototype on the client;

document.getElementById('elementId').value should also do the trick in the standard DOM environment.

+1
source share

It worked for me

 storeEval | storedVars['nextRow'] = ${nextRow}+1 | 
0
source share

All Articles