VMware {code} Community
Peter_Ivanov
VMware Employee
VMware Employee

Enable vSphere Web Client Automation

In this post I will provide some files and instructions that will allow you to create automated tests for the vSphere Web Client.

Important notes, before you start:

  • This post describes how to enable the automation and not how to write automated tests. Refer to official Adobe documentation for instructions on automating flex application: Adobe Flex 4.6 * Creating applications for testing
  • Instructions and bits provided here are version specific. When you upgrade your Web Client you need to refer back to this page and download the corresponding bits.
  • Each zip file contains a PDF with instructions. Read them carefully before you begin and follow them strictly to avoid build or product issues.
  • Create a backup copy of the modified files before you modify/replace them.
  • Use the instructions here only for testing purposes and never in production environment.
  • The instructions and bits here are provided without any warranty. If something doesn't work as explained or as expected, come back to this forum for support.

Summary

Enabling automation of a Flex application requires a number of libraries to be built in the application. The instructions and bits provided here will allow you to build you own customized copy of the vSphere Web Client.

Here is a summary of the steps that you need to perform to achieve this:

  1. Download the attached vsphere-webclient-automation-x.y.x.zip file that matches the Web Client version that you use.
  2. In your Web Client deployment find a file named container-app-war-x.y.z.war. This is a web archive that contains a file UI.swf. This is the main Flex application that is executed. It loads dynamically all other modules and plugins.
  3. Copy the container-app-war-x.y.z.war file to your local machine.
  4. Run the build script provided in the zip file. The build is Maven based. So you will need Java and Maven installed on your machine. Use the recommended versions specified in the PDF with instructions. The build might or might not work with the latest Java and Maven versions.
  5. The script will build new UI.swf file and will replace the original one in the container-app-war-x.y.z.war file.
  6. Finally you need to copy the modified container-app-war-x.y.z.war file to its original location.


The provided script (pom.xml) will include the following Adobe libraries in the Web Client build:

  • automation.swc (version 4.6.b.23201)
  • automation_agent.swc (version 4.6.b.23201)
  • automation_dmv.swc (version 4.6.b.23201)
  • automation_spark.swc (version 4.6.b.23201)


There are instructions how to include the Selenium Flex API library. The dependency is added in the build script for you, but is commented out.

Additionally you can include any arbitrary Flex library you want in your customized build of the UI.swf. Look for instructions in the PDF document within the ZIP file.

Enjoy!

0 Kudos
41 Replies
prmsvm
Contributor
Contributor

Hi Peter,

>> Which version of the tool are you using? We are using version 3.0.0 internally.

     I am using 3.02 version

>>Where did you get MonsterDebugger.swc from?

     Through monster debugger tool, Open monster debugger. File-> Export SWC

>> How did you installed it to the local repository?

     Using the command "mvn install:install-file -Dfile=MonsterDebugger.swc -DgroupId=com.test.monster -DartifactId=debugger -Dversion=1.0.0 -Dpackaging=swc"

>> How did you add the Monster Debugger to the container-app build? Can you send me the pom.xml?

        By adding the dependency in pom.xml. Please find the attached pom.xml


Thanks in Advance.

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Sorry for the delayed response.

Your pom.xml file looks perfectly fine. Can you send  me the compiled UI.swf file?

Can you check the content of the maven repository to see whether the monster debugger swc was installed correctly?

Please list the content of the following folder:

<your_user_folder>/.m2/repository/com/test/monster/1.0.0/

Thanks,

~Peter

0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

I have attached the compiled UI.swf which is located under "D:\vsphere-webclient-automation-6.0.1\swf\target\UI.swf"

Please find the below files under .m2 repository <user folder>\.m2\repository\com\test\monster\debugger\1.0.0

- _maven.repositories

- debugger-1.0.0.pom

- debugger-1.0.0.swc

Thanks in advance.

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

I decompiled the swf and I can see the monster debugger classes inside:

Screen Shot 2015-10-31 at 11.16.58 AM.png

There are the files in MonsterDebugger.swc version 3.0.2:

Screen Shot 2015-10-31 at 11.41.58 AM.png


Internally we are using MonsterDebugger.swc version 3.0.0 that contains two more files:

Screen Shot 2015-10-31 at 11.39.24 AM.png

I will follow up with our QE team and try to find out more. In the mean time can you try with version 3.0.0?

0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

I have installed Monster Debugger 3.0 and added MonsterDebugger.swc(3.0) library as dependency.

Even then I am unable to find the VSphere web client in Monster Debugger tool.

Note:

Screen Shot 2015-10-31 at 11.39.24 AM.png

While decompiling the UI.swf am able to see the above files using Monster Debugger 3.0.

Thanks in advance.

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Please check the following link:

Monster Debugger - Open Source Flash, Flex and AIR debugger

You need to initialize the MonsterDebugger somewhere in your plugin.

MonsterDebugger.initialize(this);

Please give it a try!

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Do you have any progress on that? Did you manage to enable the MonsterDebugger?

Thanks,

~Peter

0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

Sorry for the delay response.

Yes, After initialize the monster debugger in plugin, am able to view the web client in monster debugger tool.

Currently am working on identifying all the objects(getting id) in monster debugger.

Thanks in advance.

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

I am glad that it worked Smiley Happy

~Peter

0 Kudos
prmsvm
Contributor
Contributor

Thanks for your help and support Smiley Happy

0 Kudos
asheshshah
Contributor
Contributor

Hi Peter,

I went through the post and tried all possible solutions but not able to login to Web Client manually.

I followed the steps you provided and then restarted Virgo server and even rebooted vcenter.

Issue: The screen blacks out as soon as I login to the web client. "Unresponsive Plugin" error and then crash.

Environment: I am working on 6.0 U1 vCenter and FireFox

Please find UI.swf and pom.xml files attached.

Thanks,

Ashesh

0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,

We are able to 'mx' and other components, but we have a problem in automating spark and wizard(create Datastore, create New Virtual Machine)components.

This is due to "VMware QE Test framework(which has API's to automate spark and wizard components)" not compiled in 6.0 custom build, but we got it worked from custom build of version#5.5.1

We used below APIs to automate those components,

     - clickTiwoDialogRawChilderButton()

     - doFlexSparkType()

     - doFlexSparkRadioSelect()

Please let me know, how can we automate such components.

Many Thanks,

Thameem

0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

We are able to work only mx components, but other components like VMware ,Spark are unable to perform.

Eg: 1)while trying to click the plugin icon in the inventory list we are getting the below error

container_app.doFlexClick('name=ControlCenterShortcutItemRenderer2326','[iconName]')

"Error: The com.vmware.vsphere.client.views.controlcenter::ControlCenterShortcutItemRenderer control is not compatable with the flexClick command in this context"

2) While trying to click "Storage" in the navigator view, we are getting the below error

container_app.doFlexClick('automationName=nodeName','Storage')

"Error: The spark.components::Label control is not compatable with the flexClick command in this context"

Could you please provide the API methods to perform the VMware and Spark components.

Thanks in Advance

0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,


     Can you please give an update?


Many Thanks,

Thameem

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Hi Thameem,

Sorry for the delayed response.

You are correct that VMware QE Test Framework is not compiled in your custom build. At this point there is not much that I can do for you.

I can look for these functions and see if they can be easily extracted from the framework. But I don't promise anything...

~Peter

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Hi Ashesh,

Sorry for the late reply.

Can you check which is the build number that you have?

Can you check other browsers too?

Have you noticed any errors during the maven build?

Also I would appreciate if you capture the maven build output in a file and send it to me.

Thanks,

~Peter

0 Kudos
Thameemansari
Contributor
Contributor

No Problem Peter,

   Thanks a lot for your response. I have been using only below methods from QE Framework. Kindly try if those can get extracted from the framework,

============================================================

doFlexSparkType

doFlexSparkSelectDropDownListByIndex

doFlexSparkRadioSelect

doFlexSparkCheckUncheck

getSparkListIndexForValue

doSelectAdvancedDataGridItemByName

doSetFlexProperty

clickTiwoDialogRawChildrenButton

doFlexClickScrollingButtonBarItemAtIndex

selectMenuItemByName

doVisibleMouseOver

doVisibleMouseDownUp

===========================================================

Many Thanks,

Thameem

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

prmsvm

Unfortunately I don't have experience in writing Flex automation and I cannot help you with these errors.

I would recommend you to check the Adobe documentation and forums on automating Spark components.

Sorry, that I cannot help you with this Smiley Sad

0 Kudos
tfaron
Contributor
Contributor

In regards to people do GUI automation on the WebClient, we are using vCenter 6.0 with TestComplete for our automation. Anyone using the same? Anyone see the automation running extremely slow?

 

Thanks

0 Kudos
Nadezhda_Mozoli
Contributor
Contributor

Hi, Peter!

I have acted according to your instructions, but have faced to some problems:


1) There has been the first problem at the step 2: on machine with Windows the result of "mvn install" commnad has been "[ERROR] Unresolveable build extension: Plugin net.flexmojos.oss:flexmojos-maven-plugin:6.0.0 or one of its dependencies could not be resolved". But on machine with Linux (CentOS) "mvn install" have finished with success. In both cases I have used JDK Version 1.7.21 and Apache Maven Version 3.0.4.  


2) I have replaced old container-app-war-6.0.0.war on my vCenter (Version 6.0.0, Build 3339083) and have restarted service.

After that I can't login to my vCenter with Windows credentials, but I can login with username and password.

But I don't now what to do next. I have Firefox with Selenuim IDE, but can't recond my actions in WebClient (the only exeption is login process, but Login page on html).

I have used your "vsphere-webclient-automation-6.0.0.zip" and uncommented lines related to Flex API in pom.xml file.

Also I have tried to use "vsphere-webclient-automation-6.0.1.zip", but the result has been the same.


Could you help me? There are 2 archive: 6.0.0.zip (with result of "vsphere-webclient-automation-6.0.0.zip" ) and 6.0.1.zip (with result of "vsphere-webclient-automation-6.0.1.zip"). The each atchive contains UI.swf (after "mvn install") and pom.xml (with uncommented lines) files.

0 Kudos