Code Monkey home page Code Monkey logo

cfselenium's Introduction

Build Status

CFSelenium - A Native CFML (ColdFusion) Client Library for the Selenium WebDriver

What is CFSelenium?

CFSelenium is a ColdFusion Component (CFC) which provides a native client library for the Selenium WebDriver. This allows you to write tests, using CFML, which will drive a browser and verify results.

This version has dropped support for Selenium-RC and Selenium-IDE. Also the tests have been rewritten for TestBox by Ortus Solutions.

Requirements

  1. Lucee 4.5+ or Adobe ColdFusion 11+
  2. TestBox if you want to run the test suite

Implementation

Ensure that the standalone Selenium Server jar file is in your Java load path. You can add this to your Application.cfc to ensure the file is loaded.

this.javaSettings = { loadPaths = [ '/path/to/cfselenium/lib/selenium-server-standalone-3.4.0.jar' ] };

To create an instance of Selenium WebDriver:

selenium = new cfselenium.SeleniumWebDriver( driverType="firefox", webDriver="path/to/webdrivers/webDriverFilename" );

where webDriverFilename is the binary for the platform you are running. See the example in tests/specs/firefoxSpec.cfc

Currently the Firefox WebDrivers for both Macintosh and Windows are provided. Other browsers and operating systems will be added as test coverage increases.

Using WebDriver

Example: Get a page title.

selenium = new cfselenium.SeleniumWebDriver( driverType="firefox", webDriver="path/to/webdrivers/webDriverFilename" );
driver = selenium.getDriver();
driver.get( "https://www.google.com" );
writedump( var="#driver.getTitle()#" ); // evaluates to "Google"
driver.quit();

Testing

Running the Tests

cd /path/to/my/webroot/ # or wherever you want to put stuff
git clone https://github.com/teamcfadvance/CFSelenium.git cfselenium
cd cfselenium
git checkout master
git clone https://github.com/Ortus-Solutions/TestBox.git testbox
cd testbox
git checkout master
Multi-CFML-Engine Testing using CommandBox

One super-easy way to do tests in different CFML engines is this is to install CommandBox by Ortus Solutions , run the executable, then, within CommandBox:

cd /path/to/my/webroot/ # or wherever you'd put it
# testing in Lucee 4.5, for instance
server start [email protected] # when done testing, run `stop`
# testing in ACF 11, for instance
server start cfengine=adobe@11 # when done testing, run `stop`

That will open a browser window with a random port (e.g., 62261), after which, browse to the following to run the tests and see the results:

Support

Please use the main repo's issue tracker to report bugs and request enhancements.

Credits

The script-based version of CFSelenium was created by Bob Silverberg and the tag-based version was created by by Brian Swartzfager. Marc Esher provided the logic which starts and stops the Selenium-RC server automatically. @Lampei and Jamie Jackson added WebDriver support.

Richard Herbert refactored the WebDriver approach and removed support for Selenium-RC and Selenium-IDE. The tests were rewritten using TestBox/CommandBox and MXUnit has been removed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.