A bunch of JSAPI tests are located in common/test/js. Read these to get familiar with the API. The "client" side of the JSAPI interface is located in common/src/js, with the "server" side of it in common/src/js/extension.
Navigate to your checked-out copy of Selenium 2.0 and run
Rename build/webdriver-extension.zip to build/webdriver-extension.xpi and open it with Firefox to install it. Once you've restarted Firefox, you're ready to access the JSAPI.
To write your own tests, copy $SELENIUM/third_party/closure/goog to a new folder, and copy everything in common/js/test to a folder called "jsapi" inside of your new folder.
Create a web page to hold your tests and include both goog/base.js and deps.js. You'll generate deps.js momentarily. Write your tests that use the JSAPI either in the page you just created or in a separate JS file that you source in. For example,
The newSession() call is critical to initializing the interface, and you generally need to wrap sequential calls through the JSAPI in callFunction() as shown above because it is an asynchronous API. The JSAPI tests do quite a bit more, but this is the minimum viable setup.
To generate deps.js, run
Questions? Contact Eric Allen.