问题
I saw similar topics but nothing exact.
When I used Firefox and the IDE I was able to use StoreEval | Math.round (Math.random() * 99999999999) to create a random number of a specific length. I have now moved to Chrome to use the IDE and "StoreEval" is no longer an option. I have tried all the new "store" options available but end up with the below warning in the logs and the number is not created:
"Warning implicit locators are deprecated, please change the locator to id=Math.round (Math.random() * 99999999999"
Any ideas on what I need to use/change? I will admit I am not exactly sure what "please change the locator to" means.
Thanks!
回答1:
You must use execute script command in the last version of Selenium IDE.
- Right click on any command, and select "Insert New Command"
Insert the following. The result will be stored in
myRandomNumber
Command : execute script Target : return Math.random() Value : myRandomNumber
You can then reference this variable in the Value of any Command, using
${myRandomNumber}
Note: You can also see your generated random number. To do so, add another Command:
Command : echo
Target : ${myRandomNumber}
来源:https://stackoverflow.com/questions/52894485/chrome-selenium-ide-random-number-generator