Variable name must start with underscore


#1

I am getting the following error:

[error] Invalid variable name ‘6035710253599751514’. A variable name must start with a letter or the underscore character.

I understand why it is happening, but if I change it to add an underscore, it is not recognized as a number later when using the storeEval command. How do I get around this? Screenshots are attached.


#2

On the right side of store or storeEval you need the variable itself (e. g. “abc”), not the variable value like “${abc}”.

start

So this should be

storeEval | ${start} + 1 | start


#3

Alright, that worked. Thank you for your help. But now I have another problem.

I changed the ${start}+1 to storedVars.AAA++; because I wanted to change the value of the digit by one, not add a 1 on the end.

Now it almost works, except instead of going from “…9753981” to “…9753982”, it changes to “…9754000”, and keeps repeating that over and over.


#4

Uh, that is a screenshot of the Katalon Selenium IDE, but this forum is for users of the Kantu Selenium IDE :smiley:

Personally I have not much experience with Katalon since it lacks some key features I need and it’s not open-source. But for Kantu I know that ${start} + 1 does increase the value of the variable. I guess it automatically detects the type (integer or string).


#5

I am using a few different Selenium copies because each one does things a little differently.

When I program my Kantu exactly like yours, except with the bigger number, is goes from …751514 (my stored number) to …751000, as you can see on the echo. It went up 486, not 1.


#6

Strange issue, I tried with a number as big as yours, but it still just adds 1. As as test, can you please change your storeEval command to

storeEval | parseInt (${start}) + 1 | start

With parseInt we explicitly make clear that this is an integer. Does this solve the issue?


#7

Still didn’t work. Can you try my exact number?


#8

Sure. Can you please paste your number here? I don’t want to copy it from the screenshot :wink:

Actually, best if you paste the complete test macro, so I have exactly the same code as you.


#9
{
  "CreationDate": "2018-11-15",
  "Commands": [
    {
      "Command": "store",
      "Target": "6035710253599751514",
      "Value": "start"
    },
    {
      "Command": "storeEval",
      "Target": "${start} + 1",
      "Value": "start"
    },
    {
      "Command": "echo",
      "Target": "${start}",
      "Value": ""
    }
  ]
}

It looks like my “parseInt** (${start}) + 1” command didn’t show up in the actual code. When I changed it manually, it looks like it keeps reverting to “${start} + 1”.


${AAA} + 1 not working properly
#10

Please use the code tag for your code snippet :wink:


#11

For new post about adding error, see here: ${AAA} + 1 not working properly