How and where to use “Rollup” command in selenium IDE

“Rollup” command is used as a bunch of commands in selenium IDE. “Rollup” command is very useful feature in selenium IDE to reduce size of test case. Let me tell you one example for better understanding. Suppose we are testing any mail login software application features considering bellow given scenarios.

Software Test Scenario1 :
  • Login in to email account.
  • Click on “Inbox” folder.
  • Logout
Software Test Scenario2 :
  • Login in to email account.
  • Click on “Draft” folder.
  • Logout
For above scenarios, my test case in selenium IDE will be as bellow.
New Test
Command Target Value
open Replace with my mail login URL
sendKeys Replace with element id of User ID field myuserid
sendKeys Replace with element id of password field mypassword
clickAndWait Replace with element id of login button
click Replace with element id of inbox folder
clickAndWait Replace with element id of signout button
open Replace with my mail login URL
sendKeys Replace with element id of User ID field myuserid
sendKeys Replace with element id of password field mypassword
clickAndWait Replace with element id of login button
click Replace with element id of Draft folder
clickAndWait Replace with element id of signout button

Now Using Rollup Command, above test case will be as bellow.

New Test
Command Target Value
rollup logincommands
click Replace with element id of inbox folder
clickAndWait Replace with element id of signout button
rollup logincommands
click Replace with element id of Draft folder
clickAndWait Replace with element id of signout button

Now you will think how this will works. Before using “Rollup” command, you need to create userextension-rollup.js file and need to attach it with selenium IDE. 
I created sample userextension-rollup.js. Click here to download it. Attach that file as a user extension with selenium IDE. Click here to know how to attach user extension file with selenium IDE. (Replace all targets with real id or name or xpath of targeted element before attaching file). After attaching file, copy paste above test case in your selenium IDE.
In this way, you can use ‘Rollup’ command with selenium IDE when you need to use bunch of commands frequently in same test case or different test cases.

10 thoughts on “How and where to use “Rollup” command in selenium IDE

  1. That's nice. Thank you!

    I'm wondering if I have to write an userextension for every rollup I want to use.
    It is just copy&paste all the commands, targets and values from the Source tab in the IDE. What a stupid work…
    It would be fantastic if I could just mark the commands for the rollup in the IDE an create the userextension by mouseclick.
    Is there any posibility to do so?

  2. Yes, user-extensions.js is just that… user extensions. You can have as much JavaScript as you would like in that file. So just edit the file and add all the code you want to use in a single file including your SideFlow and your RollupManager configuration.

    Also, since the user-extensions.js is the last one loaded on the page… you have full access to Selenium's JavaScript objects and API.

    I don't see in Selenium IDE how to use the GUI to create the rollups… However, you're more than welcome to program it in JavaScript and contribute it back to the Selenium IDE project at:
    https://github.com/SeleniumHQ/selenium

    More precisely the IDE code lives at:
    https://github.com/SeleniumHQ/selenium/tree/master/ide

    Selenium IDE itself is a Firefox extension. If you don't know how to develop one see:
    https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/Firefox_addons_developer_guide/Firefox_extensions_and_XUL_applications

  3. Hi, can you help me on using mutliple rollup.js in selenium IDE. I have tried uploading 2 rollup.js but only one is identified by selenium IDE command rollup.

  4. Hi, can you help me on using mutliple rollup.js in selenium IDE. I have tried uploading 2 rollup.js but only one is identified by selenium IDE command rollup.

  5. Instead of uploading multiple files, you should include the rollup rules in one javascript file like this:

    var manager = new RollupManager();

    manager.addRollupRule({
    name: 'name_rule1',
    description: 'description of rule1',
    args: [
    // include arguments here
    ],
    commandMatchers: [],
    getExpandedCommands: function(args) {
    var commands = [];
    // include commands here

    return commands;
    });

    manager.addRollupRule({
    name: 'name_rule2',
    description: 'description of rule2',
    args: [
    // include arguments here
    ],
    commandMatchers: [],
    getExpandedCommands: function(args) {
    var commands = [];
    // include commands here

    return commands;
    });

Leave a Reply

Your email address will not be published. Required fields are marked *