com.isomorphic.webdriver

## Class SeleneseRunner

- java.lang.Object
- - com.isomorphic.webdriver.SeleneseRunner

-     public class SeleneseRunner
      extends java.lang.Object

  Selenese -> Java conversion and executor requires HTML parser from http://htmlparser.sourceforge.net/

       Usage: [-ff|-ie|-ch] [-d|-debug] [-q|-quiet] [-p <configFile>] [-s <sourceFile>] [<baseUrl>] <testFile>...
               -ff | -ie | -ch to specify the browser to be used. Default is FireFox
               -d | -debug outputs actions being executed and inserts a 5
                            second delay between each.
               -q | -quiet means that results are not reported. Exit
                           status of 0 implies all successful
               -p <configFile>
                           Java properties file specifying custom capabilities that
                           will be passed as configuration to the driver constructor
               -s <sourceFile>
                           approximate Java code for JUnit type testing
                           is produced and written to this file.

       Note that baseUrl must be provided if you want the script to execute, and that it's required
       if you don't provide the sourceFile argument, since otherwise SeleneseRunner will have
       nothing to do.  Test files must adhere to the standard naming pattern [Test Name].rctest.html

  When the SeleneseRunner is used in source generation mode (ie With the -s flag), JUnit test cases are written to the specified output file. If, instead of a filename, a hyphen ("-") is given as the parameter following the flag, then the test cases are written to standard output. The format of the test cases is as JUnit4: @Test annotations are provided and the name of each individual test case is derived from the filename of the Selenese test being decoded. If multiple test cases are decoded in a single run, all of the resulting JUnit tests are written to the same output file.

  The JUnit test cases are provided in a "bare bones" manner: The Java code to create a Test Class is not provided. The tests also pre-suppose the existence of a "driver" instance (an implementation of `SmartClientWebDriver` correct setup for your desired choice of Browser and system under test).

  Please note that the Selenese tests will be executed during processing if the `baseUrl` argument is provided, even in source generation mode. Any failing statements will result in a comment being inserted into the Java code to record the point of failure. This should assist your Java developers in working with and/or enhancing these tests.

  Examples

  1. Direct execution From within the lib-WebDriverSupport directory, the following command line statement will run a Selenese test case (or multiple) against a server running (in this case) on localhost port 8080. It will report pass/fail status for each individual test run (just one in this case) and also return a non-zero return status in the case that one or more tests fail. This will commonly be the simplest way in which to run Selenese tests as part of you CI framework to detect errors if you wish to use WebDriver rather than our preferred approach: Selenium 1.0

     `java -cp "*" com.isomorphic.webdriver.SeleneseRunner "http://localhost:8080" "../../tests/dataTypes-1.rctest.html"`

     The return code status can be used to wrap a Selenese test case to run it as a JUnit test case if this is desirable.

  2. Conversion to Java From within the lib-WebDriverSupport directory, the following command line statement will run a Selenese test case (or multiple) against a server running (in this case) on localhost port 8080. It will report pass/fail status for each individual test run (just one in this case) and also return a non-zero return status in the case that one or more tests fail. It will also write a JUnit4 test case for each Selenese test to the file specified by the file described following the -s flag.

     `java -cp "*" com.isomorphic.webdriver.SeleneseRunner -s unitTest.java "http://localhost:8080" "../../tests/dataTypes-1.rctest.html"`

     Note that providing the URL for conversion to Java is optional. If it's not provided, Java code will still be generated as output, but it won't be executed and won't be commented with any notes about which commands failed or threw exceptions.

     Resulting Java:

          @Test
          public void /home/ianr/dev/cvs/current/isomorphic/smartclient/client/reference/inlineExamples/grids/autofit/autofitRows_1() {
              driver.get("SmartClient_Explorer.html#autofitRows");
              driver.waitForElementClickable(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[14]/col[1]"));
              driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=1||length=7||classIndex=0||classLength=3||roleIn
         dex=0||roleLength=3||title=Data%20set%3A%205%20records||scRole=button]/"));
              driver.waitForElementNotPresent(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[5]/col[1]"));
              driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=3||length=7||classIndex=1||classLength=3||roleIn
         dex=1||roleLength=3||title=Data%20set%3A%2010%20records||scRole=button]/"));
              driver.waitForElementClickable(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[9]/col[1]"));
              driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=5||length=7||classIndex=2||classLength=3||roleIn
         dex=2||roleLength=3||title=Data%20set%3A%2015%20records||scRole=button]/"));
              driver.waitForElementClickable(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[14]/col[1]"));
              driver.click(ByScLocator.scLocator("//FeatureExplorer[ID='featureExplorer']/exampleViewer/exampleViewPane[Class=ExampleViewPane||index=0||length=1||classIndex=0||classLength=1]/viewContainer/child[Class=IButton||index=1||length=7||classIndex=0||classLength=3||roleIn
         dex=0||roleLength=3||title=Data%20set%3A%205%20records||scRole=button]/"));
              driver.waitForElementNotPresent(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[5]/col[1]"));
              driver.verifyText(ByScLocator.scLocator("//ListGrid[ID='countryList']/body/row[4]/col[fieldName=countryName||1]"), "Germany");
          }