Selenium-RC: Selenese HTML Tables

Selenese HTML Tables are normally tested using Selenium IDE or using Selenium Core by itself. (The Selenium Server includes its own copy of Selenium Core.) But there are a few ways you can use the Selenium Server with your Selenese HTML Tables.

Running Selenese Core Tests against an unmodified website

To run Selenium Core tests, they normally have to be installed on the server on which you want to test. That means that you can't just write a Selenium Core test against google.com, because you'd need to install Selenium Core on google.com for those tests to work.

The Selenium Server's client-configured proxy allows you to run your tests against any web site, by making the browser think that your tests are available at (for example) http://www.google.com/selenium-server/MyTestSuite.html.

To use the Selenium Server as a proxy, run your tests like this:

   java -jar selenium-server.jar -htmlSuite "*firefox" "http://www.google.com" "c:\absolute\path\to\my\HTMLSuite.html" "c:\absolute\path\to\my\results.html"

That will automatically launch your HTML suite and wait the specified number of seconds for the test to complete; if the test doesn't complete within that amount of time, the command will exit with a non-zero exit code and no results file will be generated.

Note that this command line is very long and very finicky... be careful when you type it in. (You can use the -htmlSuite parameter with the -port and -timeout options, but it is incompatible with -interactive; you can't do both of those at once.) Also note that it requires you to pass in an HTML Selenese suite, not a single test.

Running Selenese Tests under Continuous Integration

If you just want to use the Selenium Server as a quick-and-dirty way to launch your HTML Selenese suites from the command line and generate results automatically, you can do that, too, just by following the instructions above.

We've also provided an Ant task to make it easier to launch the tests. Run it like this:

<taskdef resource="selenium-ant.properties">
    <classpath>
        <pathelement location="selenium-server.jar"/>
    </classpath>
</taskdef>
<selenese 
    suite="c:\absolute\path\to\my\HTMLSuite.html"
    browser="*firefox"
    results="c:\absolute\path\to\my\results.html"
    multiWindow="true"
    timeoutInSeconds="900"
    startURL="http://www.google.com" />
See the javadoc for additional configuration details.

Translate Selenese Tests into Another Language

The latest versions of Selenium IDE include outstanding support for translating HTML Selenese tests into other languages; the latest version supports converting HTML Selenese into Java, C#, Perl, Python and Ruby. The Selenium IDE translator is an excellent migration tool for when you've outgrown some of the limitations of HTML Selenese.