cw84
cw84

Reputation: 2190

How do I automatically increment a number in Selenium IDE (Chrome)

I have been trying to create a looping script which increments a number by 1 with each loop.

These are the commands:

Store | 1 | i | Times | 5 | Execute Script | return ${i} + 1; | i | Echo | ${i} | End

When the script loops, it outputs the following in the log:

echo: 1 echo: 11 echo: 111 echo: 1111 echo: 11111

I have tried this instead:

Execute Script | return ${i} ++; |

But this outputs:

echo: 1 echo: 1 echo: 1 echo: 1 echo: 1

Upvotes: 0

Views: 2635

Answers (3)

Gyana
Gyana

Reputation: 1

It works for me, I wanted to increase the variable with 1 and only this command works in selenium ide 3+ Execute Script|return Math.floor(${i})+1|i

Upvotes: 0

Michael Marshall
Michael Marshall

Reputation: 1

its abit of a long way round, but i've found that this process works:
storeEval ¦ 0 ¦ loop
echoandwait
while ¦ ${loop}<50
execute script
storeEval ¦ ${loop}+1 ¦ loop
endwhile

Upvotes: 0

Roslyakova Maria
Roslyakova Maria

Reputation: 456

I use this command to increment iterator i

Execute Script|return Math.floor(${i})+1|i

Upvotes: 1

Related Questions