Some people have asked us if it is possible to have a user repeat a number of actions after they have logged in or created an account.
Below is a sample RBU script that does just that. The same idea can apply for VU scripts too.
Please keep in mind that the loop should be “contained” and ideally set to a minimum loop count during validation – otherwise you’ll be waiting a long time for the script to validate!
var selenium = browserMob.openBrowser(); // Change this to whatever makes sense for the load test var loops = 10; if (browserMob.isValidation()) { loops = 2; // no need to loop so many times if we're validating! } // now login here - things done here will not be part of the reported transactions... selenium.open("http://example.com/login"); selenium.type("username", "patrick"); selenium.type("password", "password"); selenium.clickAndWait("login"); // now start the loop which will run the "real" transaction multiple times against the same browser session. for (var i = 0; i < loops; i++) { browserMob.beginTransaction(); browserMob.beginStep("Home page"); selenium.open("<a href="http://example.com/home" target="_blank">http://example.com/home</a>"); browserMob.endStep(); // more steps and browser actions here... browserMob.endTransaction(); }




Recent Comments