Top Rounds
| We are Hiring! |
[Hide Navigation]

Sahi Flex Support - sfl (Beta) ·

Introduction:

Sahi Pro provides support for automation of flex applications. Before automating your flex application
you will first need to compile your swf with the correct version of sfl.swc

Eg. If your application is compiled with Flex 4.0, use sfl4.swc

Please find the corressponding sfl.swc at sahi_pro/sfl directory.

Compile with sfl.swc using command line

You can compile your flex application with sfl using the following command (Change sfl version as
needed)

mxmlc yourapp.mxml -include-libraries+=sfl4.swc --output=yourapp.swf

Compile using Ant

You can use this ant target to compile your flex application with sfl.

<project name="sahiTest" basedir="." default="build-flex-app"> <!--classpath : path of flexTasks.jar--> <taskdef resource="flexTasks.tasks" classpath="lib/flexTasks.jar" /> <property environment="env"/> <!--FLEX_HOME env value should be set--> <property name="FLEX_HOME" value="${env.FLEX_HOME}"/> <target name="build-flex-app" > <mxmlc file="Sample.mxml" keep-generated-actionscript="false" incremental="false" fork="true" append="true" verbose-stacktraces="true" > <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/> <!--dir: dir path of sahi flex compilation libraries--> <compiler.include-libraries dir="flex-addons" append="true"> <include name="sfl4.swc" /> </compiler.include-libraries> <source-path path-element="${FLEX_HOME}/frameworks"/> <compiler.source-path path-element="src"/> </mxmlc> </target> </project>

Compile using Adobe Flash Builder (Add SWC files to Flex Builder projects)

  1. In Flex Builder, select your Flex project in the Navigator.
  2. Select Project > Properties. The Properties dialog box appears.
  3. Select Flex Compiler in the tree to the left. The Flex Compiler properties panel appears.
  4. In the “Additional compiler arguments” field, enter the following command:
    -include-libraries “sfl4.swc”

In Flex Builder, the entries in the include-libraries compiler option are relative to the Flex Builder installation directory.

The default location of this directory on Windows 32 bit is C:\Program Files\Adobe\Flex Builder and on Windows 64 bit is C:\Program Files(x86)\Adobe\Flex Builder

After compilation refresh the browser cache, to make sure that the modified yourapp.swf is available.

Recording a flex application

From the dashboard, open any browser and navigate to your flex application.
Press ALT and double click on the document window of the page which you want to record. Sahi’s Controller window will pop
up. You can now start recording your Flex application.

NOTE:

Ctrl + hover (to get a flex element’s accessor) will work only if the Flex object is in focus. To do
this, you will have to first click on the Flex object.
Flex APIs are different from the normal JavaScript APIs.

Eg.
_f("flex_app_id").textinput("username2")

For Recognizing Custom Components:

Sahi, by default adds most of the default components. To add custom components from your application to Sahi,

edit /userdata/config/user_extensions.js as,

SflWrapper.prototype.addCustomMetaData = function(){ this.addMetaData({qn: "<package-name>::<component-name>", attributes: ["label", "text", "name", "automationName", "toolTip", "id", "autoGeneratedName", "index"], action: "click", value: "label"}); }

For example:
<package-name>: mx.containers <component-name>: Panel




---


Top Rounds