Data-Driven Testing with Selenium-RC & HTML Tests

Last month, I made a post on the Sauce Labs blog re: how to do data-driven testing with Selenium-IDE.  A reader asked if it was possible to do data-driven testing from a Selenium-RC command line with HTML tests.  The answer is a resounding “yes!”  Below are the steps for testing the first column of footer links for the Sauce Labs home page, the same test as I used in last month’s post, only using Selenium-RC this time. Many of the steps are identical to those in my previous post, but many are different, so be careful!

  1. Download goto_sel08.js from the flowControl page on the OpenQA Wiki.
  2. Download the 1.3 version of the includeCommand4IDE extension. The filename of the extension, as downloaded, is user-extensions.js.includeCommand4IDE.
  3. Download the most recent version (0.2) of the datadriven.js extension.
  4. Create a single file, which must be named user-extensions.js, consisting of an end-to-end placement of the three files you’ve just downloaded above, in the same order as listed above. This order is critical!
  5. Create an .xml file: 

    <test linkText="How It Works" title="Sauce OnDemand: Cross browser testing with hosted Selenium testing in the cloud - Sauce Labs"/>
    <test linkText="Downloads" title="Sauce Labs Downloads"/>
    <test linkText="Pricing" title="Sauce Labs Pricing For Hosted Selenium in the Cloud"/>
    <test linkText="Support" title="Support: Sauce RC (Selenium RC) - Sauce Labs"/>
    <test linkText="Forums" title="Sauce Labs Forums"/>
    <test linkText="Blog" title="Selenium Testing? Do Cross Browser Testing with Sauce Labs"/>
    <test linkText="Flash/Flex Solution" title="Automate testing of your Flex and Flash Web Apps - Sauce Labs"/>
    <test linkText="Documentation" title="Documentation - Sauce Labs"/>
    <test linkText="About" title="About - Sauce Labs"/>
    <test linkText="Team" title="The Sauce Labs Team"/>
    <test linkText="News" title="Selenium News &amp; Events - Sauce Labs"/>
    <test linkText="Webinars" title="Webinars - Sauce Labs"/>
    <test linkText="Contact us" title="Support Contact - Sauce Labs"/>
    <test linkText="Service Status" title="Status - Sauce Labs"/>


    linkText and title are variable names of my choosing. You can use any names you want, and also any number of variables you want. The critical thing is that each <test> container must contain all the data–input and output–for a single test case.

  6. View your .xml file in the browser to ensure that it does not contain any errors (only necessary if you did not use an XML editor to create the file).
  7. Utilize your .xml file via creating an HTML test case:
    loadTestData file:///Users/mamp/Desktop/BLOG/saucelabs-footer.xml
    while !testdata.EOF()
    clickAndWait link=${linkText}
    verifyTitle ${title}
  8. Be sure to replace the URL for the .xml file provided to loadTestData above with the appropriate URL on your computer.

  9. Use Selenium-IDE or an editor to create an HTML test suite that includes your data-driven test as one of the tests to be executed. This is necessary even if you only want to run one data-driven test at a time because Selenium-RC provides only an -htmlSuite option, not an -htmlTest option.
  10. Execute a command line similar to this one:

    java -jar selenium-server.jar -userExtensions user-extensions.js -htmlSuite “*chrome” ./testsuite.html results.html

    You’ll probably need to provide a path in front of the selenium-server.jar, user-extensions.js, testsuite.html, and/or results.html arguments; I put all four files in the same directory just to keep things simple.

    Note that your single file of extensions must be named user-extensions.js even though the -userExtensions option’s requirement for a filename argument would imply that the file can be named anything.

  11. If all goes well, you should see something like this:

About Mary Ann May-Pumphrey

I'm a software QA automation engineer, focusing primarily on Selenium/Webdriver automation of the front end of web apps. View all posts by Mary Ann May-Pumphrey

67 responses to “Data-Driven Testing with Selenium-RC & HTML Tests

  • Quan Khu

    For data driven test, it is easy to configure with Selenium compared to Silk or QTP

  • Mary Ann May-Pumphrey

    One issue with using RC with HTML tests (data-driven or otherwise) is the limitation of just one user-extensions.js file per cmdline AND with exactly that name. How is one to know (at a glance) which extensions (or even how many extensions) have been put into any given user-extensions.js file?

    The best solution I can come up with is to use a standard naming convention for each extensions file, such as goto_include_datadriven.js for the 3-extension-file example above. Then the test framework would have to create a symbolic link named user-extensions.js that would point to the appropriate extensions file, like this:

    -rw-r--r-- 1 mamp staff 21702 Feb 24 22:33 goto_include_datadriven.js
    lrwxr-xr-x 1 mamp staff 26 Feb 24 22:33 user-extensions.js -> goto_include_datadriven.js

  • Marcio

    Hello Mary,

    I really enjoyed your article, but I’m having a doubt.

    After adding these JS file in my user-extensions.js, my other roles were reversed. Ie they are no longer performed. Got any ideas?

    • Mary Ann May-Pumphrey

      Hi Marcio! Thanks for your comment!

      I’m not sure what you mean when you say “my other roles were reversed.” Are you saying that other extensions of your own that were in the user-extensions.js file no longer worked? If so, please send the file to me at mam_p at yahoo dot com, and I’ll be happy to take a look. (Please include a description of what didn’t work–maybe a JS function you wrote or JS variables you were using to hold testdata, etc.)

      If you’re instead referring to the fact that one cannot use the same user-extensions.js file for running HTML tests inside IDE vs. running those very same HTML tests with RC with the -htmlSuite option, that is indeed the case AFAIK. There are simply different extensions for providing flow control for IDE vs. RC. However, I have some thoughts on how to “manage” that issue, so if this is the issue to which you’re referring, add a Comment here, and I’ll write back with my thoughts.

  • Alex Everitt

    Thank you so much for putting these steps together in one place! This is what bloggin’ is all about!

  • avani

    Hi Mary, I am using selenium RC and bromine for automating my tests. I wanted to do data driven testing using XML but the loadtestdata is not working with RC it shows unknown method “loadTestData” where as it works absolutely fine with IDE. can you please help me with this. i have created the userextensions file and added it to selenium core as your directions. Thanks in advance.

    • Mary Ann May-Pumphrey

      Hi Avani! I’m not familiar with Bromine, but I did 3 minutes of research just now 😉 and got a bit confused. It sounds like Bromine works with PHP and Java tests, but not HTML tests. My post is about how to do data-driven testing with HTML tests. Am I missing something about Bromine?

      I’m also confused about your comment about adding your user-extensions file to Selenium Core per my directions. My directions didn’t say anything like that! They said to create one single end-to-end user-extensions.js file composed of all the individual extension files that you used with IDE.

      That said, I need to check whether the steps I outlined will work with the latest versions of the Selenium server. There has been a LOT of discussion on the Selenium Developers Google Group lately about what to do about user-extensions. So, I’m guessing my steps won’t work with newer versions of the server. I need to start specifying which version I used for my blog posts. I am actually not too happy with the way 2.0 is being rolled out. This situation is a good example of why!

      Anyway, please write back with answers, and I’ll do the checking tomorrow, then update my blog. Sorry you’re having these problems. Data-driven testing with RC and HTML tests was really fabulous using Selenium-1….

  • Santhosh

    I tried the same steps but the testsuite is not running…

    I am using selenium-remote-control-1.0.3 server.

    Testrunner is kicked off but the test is not running without user-extensions.js parameter its working fine only with user-extensions.js parameter the test runner gets hanged once kicked off.

    Could you please help me out with this… i need to run with user-extensions.js

  • Santhosh

    Hi Mary,

    I followed the above steps as such but couldn’t run the test.

    Without adding the user-extension.js the testsuite is working fine…

    With user-extension.js the testrunner is kicked off but hangs without running the suite.

    Could you please help me on this???

  • Mary Ann May-Pumphrey

    Hi Santhosh! Sorry you’re having problems getting the example running. Please send the following attachments to me at

    –Your testsuite.html file
    –Your testcase.html file
    –Your extensions file
    –A copy/paste of your cmdline and all the output after it.
    –A snapshot of testrunner frozen

    I’ll see if I can figure out what’s going wrong for you.


    • Santhosh

      Thanks for your response… I have emailed you all the details… Please check for the same and let me know what’s going wrong..Thanks

      • Mary Ann May-Pumphrey

        Hi Santhosh. I emailed you a response with the three issues I found. The only one of sufficient interest to repeat here for the benefit of others relates to your .xml file. You had named each inner container (tag) as <search> instead of <test> as specified.

        Despite this error, your test worked in Selenium-IDE (which surprised me!) but not in Selenium-RC (which did not surprise me). Once I had fixed the issue causing TestRunner to freeze on you, I then got an error (from my RC cmdline) telling me the .xml was erroneous. Converting all occurrences of <search> to <test> eliminated that error.

  • Santhosh

    Hi Mary. Still i am facing the same issue after doing the workaround also…

    In user-extension.js i have used the tag and that the reason i have used the same tag in the xml..

    I wonder how it worked for you by changing the xml tag to without changing it in the user-extension.js file..

    I have emailed you the details…

    If possible email me the entire suite you have so that i can run the same from my side and check whether it goes well…


  • Marco

    I’ve tried this configuration but I obtain an error in line “XML.serialize = function(node) {“.
    The object XML was not found.
    Have you got any ideas?

  • Mary Ann May-Pumphrey

    Hi Marco! Sorry to hear you’re having problems with this example. Please send me your xml file, test suite, test case, and user-extensions.js file along with a copy/paste of the cmdline execution and its output, and I’ll see what I can figure out.

    Are you using the official 1.3 release of the RC server? It’s possible there are problems using the 2.x beta software–I haven’t tried it yet.


  • Marco

    The official release is actually 2.0b3. In previous releasesof SeleniumHQ site I found from 0.8 to 1.0 version. Where can I find release 1.3?

    • Mary Ann May-Pumphrey

      So, what I meant by “official” was non-beta. That “b” in 2.0b3 is short for “beta.” The expected official release of 2.0 is expected this summer or early next year, depending on who you talk to! I recommend that people new to Selenium stick with 1.0 as there is more documentation, more users, it’s easier to learn, AND I don’t think it’s a good idea to learn a new tool via a beta version!

      That said, let me try out a few things and get back to you with a more detailed response….

  • Mary Ann May-Pumphrey

    Hi again, Marco. I was able to run my example with both selenium-server-standalone-2.0b2.jar and selenium-server-standalone-2.0b3.jar.

    So, please send your test case file, test suite file, xml file, and a copy/paste of your cmdline (both input and output) so I can see what is the problem.

  • Marco

    I’ve tried again. All works perfectly with Chrome or Firefox. I was still found the problem with “XML.serialize” only with Explorer (“*iexplore”). Now I send you my files.

  • Nick Mills

    Hi Mary. I had a similar problem to Marco’s when running data driven tests in IE. The problem occurs in IDEIncludeCommand.prototype.prepareUrl, which is part of the includeCommand4IDE extension.

    This function has different code for getting the url, depending on whether it is called from IDE or RC. In IE Selenium fails to detect that it is running in RC, causing it to execute the else branch of the if statement: preparedUrl = absolutify(includeUrl, editor.suiteTreeView.currentTestCase.file.path).

    Since I’m only using userextensions.js with RC, I changed the javascript code to force it to always execute preparedUrl = absolutify(includeUrl, htmlTestRunner.controlPanel.getTestSuiteName())

  • Mary Ann May-Pumphrey

    Marco–I didn’t realize from your original post that this was an IE-specific problem. I must confess that I rarely use IE although I am pretty sure I tested it when I first developed this example (a couple years ago).

    Nick–Thanks for your very detailed info! What version of includeCommand4IDE extension shows the problem–1.3 only or also 1.1? (1.2 was a short-lived buggy version.) Could you possibly check that out, and then update the includeCommand4IDE extension page (at the very bottom) with the info about the bug?

    If you don’t want to go to the hassle of setting up an account there, just post the info here or send it to my email account (, and I’ll post it. The dev was very fast in fixing the problem with 1.2 that I pointed out (which broke IDE/DDT in a big way), so hopefully, he’ll be similarly responsive re: this issue.

    Thanks to both of you for the info!

    • Nick Mills

      This is in includeCommand4IDE version 1.3. The line preparedUrl = absolutify(includeUrl, editor.suiteTreeView.currentTestCase.file.path); is a change from version 1.1.

      I’m using selenium-server-standalone-2.0b3.jar and IE8 on Windows XP.

  • Marco

    Today I find the solution!

    1. remove “XML.serialize” definition and call
    2. modify “getIncludeDocumentBySynchronRequest” function to manage also IE7
    3. refer to my input file with “http://localhost:4445/selenium-server/” to avoid security problem (“file:///” syntax is blocked from IE and not from Firefox)

    Tell me if you want modified “userextensions.js”

    • Mary Ann May-Pumphrey

      Hi Marco! Sure, go ahead and send me your modified userextensions.js. Is it a modification of 1.1 or 1.3 includeCommand4IDE? Do you know if the XML problem only affects IE-7?

      Also, can you please provide more info on #3 from your last email?

      Or if you want to just update the Wiki page ( for the extension yourself, that’s cool too.

      My goal is providing sufficiently clear info on the Wiki to motivate the extension developer to fix the problem(s) so that future readers of my instructions above won’t encounter them.

      • Nick Mills

        I now realise that I made other changes in order to run in IE8. So, although I was commenting on the symptoms of Marco’s #1, my previous posts relate to his #2.

        I have also had the other two issues. For #1 changing XML.serialize to xmlTestData.serialize in both definition and call worked. To get round #3, I placed the test data in the same directory as the test scripts and used the file name on its own without a path.

  • Marco

    * Modification in userextension.js touch datadriven (remove XML.serialize definition and call) and includeCommand4ID 1.3 (method getIncludeDocumentBySynchronRequest)

    * Point 3: IE7 deny cross-domain data access and so also URL like “file:////”. To avoid this problem file must be downloaded from the same domain used by Selenium RC server (http://localhost:port)

    Now I send you modified userextensions.js.

  • Mary Ann May-Pumphrey

    I’ve verified both all 3 of the issues Marco documented, AND that his modified user-extensions.js fixes them.

    I’ve also alerted the developer via a comment at the bottom of

    Finally, I also wrote off to the developer to let him know about these issues. Hopefully, we’ll see a 1.4 version of the include extension with fixes in it soon.

  • Anju

    Hi Mary

    I would like to thank you for your wonderful post.
    But I am having trouble running the test suite. I followed the instructions in your post.
    As per the post i created a file user-extensions.js with the contents;

    then i copied test.xml, testsuite.html and selenium-server.jar in the same directory and run the folowind cmdline;
    java -jar selenium-server.jar -userExtensions user-extensions.js -htmlSuite “*firefox3” ./testsuite.html results.html

    09:55:17.367 INFO – Java: Sun Microsystems Inc. 17.1-b03
    09:55:17.387 INFO – OS: Linux 2.6.32-27-generic i386
    09:55:17.492 INFO – v2.0 [a2], with Core v2.0 [a2]
    09:55:18.126 INFO – RemoteWebDriver instances should connect to:
    09:55:18.129 INFO – Version Jetty/5.1.x
    09:55:18.132 INFO – Started HttpContext[/selenium-server/driver,/selenium-server/driver]
    09:55:18.135 INFO – Started HttpContext[/selenium-server,/selenium-server]
    09:55:18.136 INFO – Started HttpContext[/,/]
    09:55:18.321 INFO – Started org.openqa.jetty.jetty.servlet.ServletHandler@14f8dab
    09:55:18.322 INFO – Started HttpContext[/wd,/wd]
    09:55:18.333 INFO – Started SocketListener on
    09:55:18.333 INFO – Started org.openqa.jetty.jetty.Server@52fe85
    09:55:18.897 INFO – Preparing Firefox profile…
    09:55:26.082 INFO – Launching Firefox…
    09:55:30.103 INFO – Checking Resource aliases

    but i think the test suite is not running , the url remains as “http://localhost:4444/selenium-server/core/TestRunner-splash.html?start=true”

    Also my testsuite is ;
    loadTestData file:///var/www/test.xml
    while !testdata.EOF()
    clickAndWait link=${linkText}
    verifyTitle ${title}

    Any ideas?

    Thanks in advance

  • Anju

    Hi Mary,

    Please disregard my previous mail, it was because I forgot to add test suite file.

    Now I am getting the following error in results.html ;

    info: Starting test /selenium-server/tests/testcase.html^M
    info: Executing: |loadTestData | file:///var/www/test.xml | |^M
    error: Unknown command: 'loadTestData'^M
    warn: currentTest.recordFailure: Unknown command: 'loadTestData'^M

    I am using selenium version 2.0.

    Thanks in advance,

  • Mary Ann May-Pumphrey

    Hi Anju! loadTestData is coming from datadriven.js, which should have been embedded in your user-extensions.js file. In your description of your user-extensions.js file in your first post, you said:

    “As per the post i created a file user-extensions.js with the contents;

    Do you mean that your user-extensions.js contains just that list of filenames? It needs to contain the actual *contents* of the three extensions: goto_sel08.js includeCommand4IDE.js (or whatever you’ve called it), and datadriven.js. The user-extensions.js file does not need the filenames, just the contents. Please write back and let me know if you’ve gotten the example running. If not, please send me attachments of your user-extensions.js file, testcase, testsuite, and .xml.

  • Anju

    Thanks a lot!! Sorry for being so dumb, pasting the contents of the three files in user-extension.js solved my issue.

    As of now we test the title of each page. Instead I just want to test if a particular text is present in that page. Is it possible to pass some other value instead of “title” in .xml?

    Also I currently have a Selenium code written in java. How can I integrate this html tests in that ?

    Thanks Again!

    • Anju

      I used verifyTextPresent instead of verifyTitle.hence solved the first issue.

      Even though we specify the browser, it always launches Firefox to perform tests.Any idea why is it happening so ?

      Thanks in advance,

  • Mary Ann May-Pumphrey

    Hi Anju! The latest problem sounds really weird! Please copy/paste your command-line and the resulting output into a Comment (or send it to me offline at Also, please send me the URL from which you downloaded the server file so I can attempt to reproduce this.

    • Anju

      Hi Mary,
      Here I am pasting the command-line o/p,

      root@ubu1004:/var/www# java -jar selenium-server.jar -userExtensions user-extensions.js -htmlSuite “*chrome” ./testsuite.html results.html
      09:52:14.828 INFO – Java: Sun Microsystems Inc. 17.1-b03
      09:52:14.856 INFO – OS: Linux 2.6.32-27-generic i386
      09:52:14.972 INFO – v2.0 [a2], with Core v2.0 [a2]
      09:52:15.599 INFO – RemoteWebDriver instances should connect to:
      09:52:15.602 INFO – Version Jetty/5.1.x
      09:52:15.604 INFO – Started HttpContext[/selenium-server/driver,/selenium-server/driver]
      09:52:15.608 INFO – Started HttpContext[/selenium-server,/selenium-server]
      09:52:15.608 INFO – Started HttpContext[/,/]
      09:52:15.749 INFO – Started org.openqa.jetty.jetty.servlet.ServletHandler@14f8dab
      09:52:15.749 INFO – Started HttpContext[/wd,/wd]
      09:52:15.786 INFO – Started SocketListener on
      09:52:15.786 INFO – Started org.openqa.jetty.jetty.Server@52fe85
      09:52:16.486 INFO – Preparing Firefox profile…
      09:52:21.379 INFO – Launching Firefox…
      09:52:24.296 INFO – Checking Resource aliases


  • Mary Ann May-Pumphrey

    Hi Anju! Based on your copy/paste above, I think/hope the issue here is a common misunderstanding. “*chrome” is *supposed* to bring up Firefox. I believe what you wanted to do is to specify “*googlechrome” which brings up the Chrome browser.

  • Santhosh

    Hi Mary,

    Hope you are doing good ..

    I followed your steps and got the testcase running without any error.

    Just one quick question..Is there any way to get the storedvars result in a presentable way using Selenium IDE and also do we have any option to email the result using IDE???

    Thanks In Advance 🙂

  • Mary Ann May-Pumphrey

    Hi Santhosh! I don’t think I understand your first question. What storedVars result? Are you wanting more readable debugging statements, or a dump of all testcase variables and their values, or what?

    Re: the second question. I’m not aware of any way to email results from IDE. But this particular post is all about using not IDE, but rather RC, to run HTML tests. So, why not write a two-line shell script (or batch file if you’re on Windows) that would (a) run the RC server with -htmlSuite on a suite of HTML tests; and (b) mail the log file from (a) to whatever address you wish to specify?

  • Santhosh

    Hi Mary,

    Yes i need a dump of all testcase variables and their values in more readable format … also how can i mail the result file once the test is completed using batch file ???

  • Guy Schreiber

    Hi Mary,

    First, thanks for the post. it helped me a lot boosting my selenium experience.

    I want to write the flow of a test inside the data driven’s xml file, so that each node of the xml represents a granular test case.
    I wrote a test case that iterates over all the nodes of the xml, and load the test cases (with the Include command).
    It looks like this:

    loadTestData | file://D:/Selenium/test.xml | |
    while | !testdata.EOF() | |
    nextTestData | | |
    include | file://${TestCase} | |
    endWhile | | |

    Unfortunately it doesn’t work on the IDE (version 1.0.10) or on the server (version 2.0rc2)
    On the IDE it fails on endWhile with this exception:

    # [error] testCase.debugContext.currentCommand() is undefined
    # [error] Unexpected Exception: message -> testCase.debugContext.currentCommand() is undefined, fileName -> chrome://selenium-ide/content/selenium-runner.js, lineNumber -> 148, stack -> ([object Object])@chrome://selenium-ide/content/selenium-runner.js:148 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:159 ()@chrome://selenium-ide/content/selenium-runner.js:124 (0)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:79 (0)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> TypeError

    On the server it fails on the Include with this exception:

    error: Unexpected Exception: testCase is not defined
    error: Exception details: message -> testCase is not defined, fileName -> http://localhost:3333/selenium-server/core/scripts/user-extensions.js, lineNumber -> 340, stack -> (“file://D:/Selenium/TestSuits/TestCases/StoreFront/Storefront_Login.html”,””)@http://localhost:3333/selenium-server/core/scripts/user-extensions.js:340
    ([object Object],[object Object])@http://localhost:3333/selenium-server/core/scripts/selenium-commandhandlers.js:310
    , name -> ReferenceError

    Any idea?
    You are my last resort before i ditch this approach.


    • Mary Ann May-Pumphrey

      Hi Guy! I’ve never tried anything like this or seen any code that did. What you are trying to accomplish? Why can’t you use a test suite as defined within Selenium-IDE instead of including every test case?

      Regardless, I think your immediate problem may be related to a “case sensitive” issue. I note that your IDE code uses the titlecase “TestCase” whereas both error messages refer to “testCase.” Do the files you’re trying to include refer to “testCase?”

      Please send me the .xml (or at least the very beginning portion of it) and a little more info, and I’ll see if I can shed any light on the matter….

      • Guy Schreiber

        I want the data driven’s XML to describe the workflow of the test.
        My application is an e-commerce site, where the workflow of ordering a product differs from other products just slightly.
        I want to create a test case for each small difference (or even create just several of them with parameters), and then describe the whole test in the XML by including the right test cases for each product.

        The XML should look like this to describe 2 orders in the system, one for product A and the second for products A and B:

        As you see the titlecase TestCase is in the XML, but the camelcase testCase is an object in the datadriven js.
        I tried changing it to just TC, but it didn’t help.


  • Guy Schreiber

    Apparently while and include commands do not work together.
    According to the error, it appears that the include command makes the context of the while command to vanish.

    this code fails:

    while | 1==1 | |
    include | file://d:/selenium/test2.html | |
    endWhile | | |

    where test2.html contains just:
    open | | |

  • Anju

    Hey Mary

    Hope you are doing good.

    I got another issue. I have a selenium RC code and the site that need to be tested has HTTP authentication.
    Is it possible to handle that in selenium code?

    Thanks in advance,

  • Santhosh

    Hi Mary,

    I am not able to run the above data-driven testcase in IE … i am using the below cmd,

    “C:\Program Files\Java\jdk1.6.0_17\bin\java.exe” -jar D:/selenium-remote-control-1.0.3/selenium-server-1.0.3/selenium-server.jar -userExtensions D:\Mary\user-extensions.js -htmlSuite “iexploreproxy” “” D:\Mary\testsuite.html D:\Mary\results.html

    Normal testcase is running but data-driven is failing in IE ..

    It showing “Unknown command: loadtestdata”

    Please let me know is there anyway to overcome this issue ???

  • Mary Ann May-Pumphrey

    Hi Santhosh! Did you spell the command as “loadtestdata” (which the error message above leads me to suspect), or did you spell it as “loadTestData” which is the correct spelling? (Camel case!)


    • Santhosh

      Yes, I spell it as”loadTestData” only … the error i got while running in IE is,

      Unknown command: ‘loadTestData’

  • vinay

    Hi im Vinay , using selenium-server-standalone-2.12.0 , executed the command “D:\Selenium\src\src\selenium-server-1.0.1> java -jar selenium-server-standalone-2.12.0.jar -htmlsuite *iehta C:\testsuite\contacts.html C:\testsuite\results.html”

    After execute that command the firefox browser launched but the play button is not working in my firefox version 8 browser , I have checked the error console in the firefox and it says “html testcase is undefined” >> 😦

    please help me

    Error: htmlTestCase is undefined
    Source File: http://localhost:4444/selenium-server/core/scripts/selenium-testrunner.js
    Line: 1106

    • Mary Ann May-Pumphrey

      Vinay: Your cmdline specifies IE but you reference FF in the description, so I’m a bit confused. If you’re still having a problem, please send me a copy/paste of the cmdline for *chrome including all output, plus the contents of your contacts.html file.

  • Ali

    Great post and well described. Unfortunately, I could not run the test, not because of your example but my configuration. When I rune selenium from command line, it doesn’t go to the url that I asked in my command line. It goes to (if firefox):

    and second page is:

    If I use “*googlechrome” it looks like this:

    and :

    No clue why.
    Any help is much appreciated.

    • Mary Ann May-Pumphrey

      Could you please copy/paste both your cmdline and the contents of your DataDrivenTestSuite.html file into a reply here (or contact me offline)? Also, please let me know which version of FF you’re using and which version of the Selenium server.

      It’s not really critical that the test “go to the url” in the cmdline because the “open” statement in the test case goes to an absolute url (one that starts with the http: protocol) anyway. However, it looks from your cmdline like you’re getting the base-URL argument to -htmlSuite properly interpreted.

      I’m not sure this example will run any longer because of changes Sauce Labs has made to their site.

      But you should be able to at least see the test fail! So, I’ll be happy to help sort this out if you send me more info as described above.


  • Ali

    Sorry, in my previous example I used googlechrome, not firefox.
    Here is the result in Firefox 8:
    URL showed up in first page:

    URL showed up in second page:

    and here is what I have in my console:
    C:\Selenium\DataDrivenExample>java -jar c:\selenium\selenium-server-standalone.j
    ar -userExtensions user-extensions.js -htmlSuite “*firefox” “http://www.saucelab” C:\Selenium\DataDrivenExample\DataDrivenTestSuite.html C:\Selenium\DataDr
    Nov 29, 2011 7:23:26 PM org.openqa.grid.selenium.GridLauncher main
    INFO: Launching a standalone server
    19:23:26.859 INFO – Java: Sun Microsystems Inc. 20.2-b06
    19:23:26.859 INFO – OS: Windows XP 5.1 x86
    19:23:26.859 INFO – v2.13.0, with Core v2.13.0. Built from revision 14793
    19:23:26.968 INFO – RemoteWebDriver instances should connect to: http://127.0.0.
    19:23:26.968 INFO – Version Jetty/5.1.x
    19:23:26.968 INFO – Started HttpContext[/selenium-server/driver,/selenium-server
    19:23:26.968 INFO – Started HttpContext[/selenium-server,/selenium-server]
    19:23:26.968 INFO – Started HttpContext[/,/]
    19:23:27.031 INFO – Started org.openqa.jetty.jetty.servlet.ServletHandler@111a3a
    19:23:27.031 INFO – Started HttpContext[/wd,/wd]
    19:23:27.031 INFO – Started SocketListener on
    19:23:27.031 INFO – Started org.openqa.jetty.jetty.Server@1050e1f
    19:23:27.171 INFO – Preparing Firefox profile…
    19:23:30.671 INFO – Launching Firefox…
    19:23:31.812 INFO – Checking Resource aliases

  • Vivek

    Hi mary,
    i facing problem when i am executing data driven testing script on test runner on IE8 , i get load test data – unknown file command as per your previous post i ahve tried to merge three files- goto_sel.js, include.js and datadriven.js in user extension file. but when i execute the script i get bunch of errors

    1. xml is undefined
    2. test case is undefined

    Please help me out , i am working on live project and it si very urgent

    Vivek garg

    • Mary Ann May-Pumphrey

      Hi Vivek! Please send me: your 3-in-1 combined .js file; your testsuite (.html); your data file (.xml); and a copy/paste of your command line with the resulting output. I’m sure we can get this figured out….

      • Vivek

        Hi Mary,
        thnx for your prompt reply,
        i have sent you all required stuff. hope for the best


      • Mary Ann May-Pumphrey

        Hi Vivek! The error message you’re getting definitely indicates a problem with the user-extensions.js, where the loadTestData cmd is defined. The only problem I see with your files is with the test case’s argument to loadTestData; it should start with file:/// rather than file://. However, that mistake causes a different error message, and a *later* one than the one you’re getting.

        The good news is that I can use your user-extensions.js, .xml, and testsuite (modified only to change the file:// argument to point to my copy of the .xml) to run without any problem. Since I’m running on a Mac rather than Windows, this diff between our results is probably due to some little Windows thing.

        Here’s one of many commands that worked for me:

        java -jar ~/Desktop/SOFTWARE/*17* -htmlsuite “*chrome” ./search_suite.html ./results.html -userExtensions /tmp/user-extensions.js

        Please let me know if you’re still stuck and I’ll use a Windows system from work to look into the problem….


  • Vivek Garg

    Hi Marry,

    my test suite is running on FF on windows, but it is not running on IE8 . i have modified my script as per your given Argument , but still this script is not running on IE 8


  • Vivek Garg

    Hi Marry,
    Please tell us how to create script for goto if statement and how it will run as when we are running script with go to statement, error is coming-
    gotoif – unknown command

  • khizra

    thankz really help ful post …

  • Radha

    Hi Marry,

    I am very impressed with your posts for Selenium. I am newbie and it is really useful. I would like to know from your Data driven testing the example was with the drop down menu options that already exists in the web page. Is there a way that we can do a data driven tests by giving inputs like user inputs. I want to test a web app with different inputs that i give. Can it be done using selenium?

  • Mary Ann May-Pumphrey

    Hi Radha! You can certainly use data-driven testing with HTML tests and inputs that use the “type” command.

    However, at this point in time, I really recommend that you put the data into a .js “extension” file rather than using the include and datadriven extensions as I described in this post. This duo of extensions no longer work with even the latest version of Firefox, are not part of the standard Selenium project, etc. It’s a lot more reliable to “cut out the middle men” so to speak by putting the data into a JS extension. You’ll still need the flow control extension for IDE, but that would be it.

    My blog on how to use data-driven with IDE and a .js extension is located at

    Let me know if you have any problems. I can whip up an example using “type” commands and inputs like you describe wanting to automate, if you like….

  • Radha

    Hi Mary, Thank you very much for your reply. It would be great if you can give an example for the type commands that you have specified in your comments. Thank you very much.

  • Julia

    Hi Mary, I know this is an old thread but I just wanted to thank you – and Marco and Nick – for the assistance your discussion has given me. I am a non-programmer using Selenium for test purposes. We use it with Firefox, but really needed to also get it working with IE. Your discussions about changing the ‘XML.serialize’, and the ‘includeCommand4IDE extension: IDEIncludeCommand.prototype.prepareUrl’ gave me the springboard I needed to getting Selenium working in IE with our applications.

    I also had to implement the use of *custom and include the location of IE on the local machine, rather than *iexplore or *iehta as the embedded browser with these could not handle session authentication with cookies.

  • AleksandraC

    Hi Mary,
    Thank you for the article and I have a question.
    My TestSuite with DDT runs perfect in IDE. But when I try to start.bat for run RC (selenium-server-standalone-2.28.0) the test hangs and doesn’t run steps at all (even if first step is not using DDT). When I remove userExtension from the bat test runs (and fails of course on DDT steps).
    I use FlowControl of version from 2009; Include 4 IDE 1.1 and datadriven 02.

    Do you have any idea if DDT may work with that server version? Any ideas of what to use?

  • Daniel

    Hello, I could solve the IE issue , just changing the target for each test case from



    http://localhost:4444/selenium-Server/file.xml, it seems that IE could read an xml from local drive.

    Thanks for the Post!

  • Mary Ann May-Pumphrey

    Re: the issue on above. I think the problem is an easy one to fix. Your test suite refers to test_case_a.html but your testcase is in a file named case_a.html. So, I’m guessing that you see the SUITE loaded in the upper Firefox window but not the code of the test case itself.

    I had no problem running your test case on my Mac with the same version of the jar file you were using….

  • vinay p v

    Hi .. I am using Selenium RC.(latest version :selenium-server-standalone-2.38.0.jar )I have one doubt, Can we do load testing by using Selenium RC, if we can do please let me know the details, how it can ? im usually doing key word driven testing also the values which taken from the local database (PostgreSQL).

    Thank You,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: