Tuesday, May 27, 2008

Baby step

Okay, I took the weekend off. But today I was able to make some minor mods and added a "clickFx" command to my user-extensionts.js file and was able to have it click a button in my sample application utilizing the AutoQuick sample automation code. Here is how the JS code looks:

var flexApp = "AutoQuickExample";

// All do* methods on the Selenium prototype are added as actions.
// Eg add a typeRepeated action to Selenium, which types the text twice into a text box.
// The typeTwiceAndWait command will be available automatically
Selenium.prototype.doClickFx = function( locator, text ) {
var element = this.page().findElement( flexApp );

element.runCommand( locator, "Click", text );
};

On the Flex side, I just added an ExternalInterface callback to the AQToolBar.mxml file to hear the 'runCommand()' method call like this:

private function init() : void
{
ExternalInterface.addCallback( "runCommand", runCommand );
}

private function runCommand( id:String, method:String, args:String ) : String
{
var o:Object = AQAdapter.aqAdapter.run( id, method, args );

return "ok";
}

I don't know if I can put the AutoQuick code up but I intend to look at getting instructions put up tomorrow hopefully.

No comments: