Reading passwords from a file with Selenium IDE and SelBlock

April 14, 2016 - 1 minute read -
selenium-ide selenium selblocks

Recently I found the need to have Selenium loop through a bunch of commands for different users, each with their own usernames and passwords.

Thankfully, it's fairly painless to setup using the SelBlock plugin for Selenium IDE.

Create a datafile:

[{ user: "ash", pass: "test1234" }
,{ user: "brock", pass: "test1234" }
,{ user: "jessie", pass: "test1234" }
,{ user: "james", pass: "test1234" }
,{ user: "misty", pass: "test1234" }]

If the file is saved in the same directory as the test script, you can use a relative path.

Loop through it and log the username:

forJson varset.json
  getEval LOG.info("user is "${user}")
endForJson