How to increase value of the type per loop?

How to increase value of the type for +0,1 per loop to 1,1; 1.2; 1.3…?

Your request is not well explained. you have to specify

what is the minimum number from which to start
what is the maximum number to get
how many numbers you expect to have

otherwise you cannot answer your question precisely

minimum number = 1
maximum number = 2
i expect to have 1,1 1,2 1,3 1,3 1,5 1,6 1,7 1,8 1,9 2

You can use array

Read here

@newuserkantu posts refers to changing the value of an array variable. This is a somewhat more advanced topic.

Since you simply need to increment a Selenium IDE variable just use this:

executeScript_Sandbox | Number (${i}) + 1 | i

Note that we need the “Number ()” function to make sure that Javascript treats the content of the variable i as number (so 1+1 = 2), otherwise (as string) we would get “1+1=11” :wink:

    {
      "Name": "Increment variable",
      "CreationDate": "2021-3-17",
      "Commands": [
        {
          "Command": "store",
          "Target": "1",
          "Value": "i"
        },
        {
          "Command": "while_v2",
          "Target": "${i} <= 5",
          "Value": ""
        },
        {
          "Command": "echo",
          "Target": "i=${i}",
          "Value": "green"
        },
        {
          "Command": "executeScript_Sandbox",
          "Target": "return Number (${i}) + 1;",
          "Value": "i"
        },
        {
          "Command": "end",
          "Target": "",
          "Value": ""
        }
      ]
    }

Macro result:

Related post: Incrementing each loop - #3 by ulrich

1 Like

The user requested increase not of 1 but of 0.10 per loop (1.0, 1.1, 1.2, 1.3) for this strange increment I also recommended arrays is more easy and fast to do.

Is more simple to have an increment of 1 (from 1 to 20)

For this you only need to change +1 to +0.1 in my code:

  {
      "Command": "executeScript_Sandbox",
      "Target": "return Number (${i}) + 0.1;",
      "Value": "i"
    },
3 Likes

Your solution is very good I hadn’t thought about the solution you wrote