Selenium IDE Sideflow Update 2
Selenium IDE Sideflow Update 2
Ive updated the Sideflow (Selenium IDE Flowcontrol) plugin. You can download the latest version here: https://github.com/73rhodes/sideflow
The "gotolabel" command is renamed with camel-casing as "gotoLabel", so you may need to update your old Selenium tests if they use the old "gotolabel". Note that "goto" is a synonym for "gotoLabel", so if you wrote your tests using "goto" they should just keep working.
While I really appreciate contributions and suggestions, Ive decided to remove the recent forEach additions. There were a few reasons for this.
- foreach functionality can be done with the existing while / endWhile commands.
- The implementation of foreach didnt actually provide a foreach command.
- Users reported errors in the new feature. Given (1) and (2) I wasnt really interested in debugging it.
To provide a simple way for users to build a collection, I added the "push" command. In Selenese, "push" works like youd expect in JavaScript, except it will automatically create the array for you if it doesnt already exist.
So, to build up a collection, you can do this:
getEval | delete storedVars[mycollection]
push | {name: darren, status: groovy} | mycollection
push | {name: basil, status: happy} | mycollection
Note the use of getEval to clear the collection first. Unlike runScript, getEval runs in the context of the Selenium object, allowing us to modify storedVars.
To do something with every item in the collection (like foreach), you can do this:
storeEval | storedVars[mycollection].length | x
echo | mycollection has ${x} items
while | storedVars[x] > 0
storeEval | storedVars.mycollection[${x}-1] | temp
echo | ${temp}
storeEval | ${x}-1 | x
endWhile