CFSelenium - A Native CFML (ColdFusion) Client Library for Selenium-RC
CFSelenium is a ColdFusion Component (CFC) which provides a native client library for Selenium-RC. This allows you to write tests, using CFML, which will drive a browser and verify results via Selenium-RC.
- ColdFusion 9+
- The Selenium-RC Server jar, the latest version of which is included in the distribution
Start the Selenium-RC server. For example: java -jar selenium-server-standalone-2.0b2.jar
Create an instance of selenium.cfc, passing in the beginning url for your test: selenium = new selenium("http://github.com/");
You can also pass the host, port and browser command into the construtcor, which default to localhost, 4444, and *firefox, respectively: selenium = new selenium("http://github.com/", "localhost", 4444, "*firefox");
Call methods on the selenium object to drive the browser and check values. For example: selenium = new selenium("http://github.com/"); selenium.start(); selenium.open("/bobsilverberg/CFSelenium"); assertEquals("bobsilverberg/CFSelenium - GitHub", selenium.getTitle()); selenium.click("link=readme.md"); selenium.waitForPageToLoad("30000"); assertEquals("readme.md at master from bobsilverberg's CFSelenium - GitHub", selenium.getTitle()); selenium.click("raw-url"); selenium.waitForPageToLoad("30000"); assertEquals("", selenium.getTitle()); assertTrue(selenium.isTextPresent("[CFSelenium]")); selenium.stop();
Also included in the distribution is a Firefox extension which will add a formatter to Selenium-IDE which will allow you to export tests in CFSelenium / MXUnit format. The plugin can be found in the formats folder.