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!

Reply
0 Kudos
41 Replies
prmsvm
Contributor
Contributor

Hi Peter,

I am using vCenter Version 6.0.0 Build 2172318. I have downloaded "vsphere-webclient-automation-6.0.0.zip" and followed the below steps, as per mentioned in the document(Enabling Automated Testing for the vSphere Web Client.pdf)

Steps:

-----

1) Copied the C:\Program Files\VMware\vCenter Server\WebClient\plugin-packages\vsphere-client\plugins\container-app-war-6.0.0.war from vCenter machine to local machine(inside the extracted zip of vsphere-webclient-automation-6.0.0).

2) Uncommented Selenium flex <repository> and <dependency> in pom.xml and Executed the command mvn install

3) Now am able to see the modified "container-app-war-6.0.0.war".

4) Replaced the new "container-app-war-6.0.0.war" in vCenter machine of respective location.

5) Restarted the "VMware vSphere web client" service. Also I have tried to rebooted the vCenter machine

Able to see a only blank screen after logged into vSphere web client.

Kindly help me to resolve this issue.

Note:

If we again replace the old "container-app-war-6.0.0.war", I am able to view my home page of vSphere web client.

Reply
0 Kudos
prmsvm
Contributor
Contributor

Also didn't noticed any related errors in vsphere_client_virgo.log. Please find the attached logs as well

Reply
0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,


Thanks for your information.
Tried below steps through the link(https://communities.vmware.com/thread/520914) and the document provided.

- Upgraded existing Vcenter Server with Beta Version to version 6.0.0 Update1#build 3018524
- Build a Custom Version of the container-app-war-6.0.0.war through maven
- Replace the Original container-app-war-6.0.0.war File with Custom Version of the container-app-war-6.0.0.war
- Restarted VMware vSphere Web Client service.

Issue:
- Also unable to login to VSphere Web Client. The login page is getting reloaded
- Tried with developer tools and observed that there were no SFAPI library methods added and compiled

Notes:
- Rebooted the server machine for the VMware vSphere Web Client and other related services to get restarted
- Restarted virgo server for the changes to take effect
- Attached virgo.logs with this case

Details:
Vmware vCenter Server version : 6.0.0 Update1#build 3018524

Please let me know your thoughts on this

Many Thanks,
Thameem

Reply
0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

@prmsvmprmsvm

The provided solution works for 6.0.0 GA (Web Client reports build 2559277).

Unfortunately as mentioned in the original post it is version specific.

Reply
0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Hi Thameem,

Also unable to login to VSphere Web Client. The login page is getting reloaded

You cannot login manually or through automation?

Can you try to clear the browser cache?


Tried with developer tools and observed that there were no SFAPI library methods added and compiled

Have you uncommented the following sections in the main pom.xml file:

  • in the repositories section:

     <repository>

         <id>Selenium-Flex-API-repo</id>

         <url>http://sfapi.googlecode.com/svn/maven</url>;

      </repository>

  • in the dependencies section:


     <dependency>

         <groupId>com.googlecode</groupId>

         <artifactId>sfapi</artifactId>

         <version>0.2.6</version>

         <type>swc</type>

         <scope>internal</scope>

      </dependency>


The code is there. Just needs to be uncommented.


Thanks,

~Peter

Reply
0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,

     Uncommented below tags, cleared cache and tried already. But still the problem persists.

Many Thanks,

Thameem

Reply
0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

I have followed the compilation steps against vCenter Server 6.0.0 Update 1 (Build:3040890).

I am not able to login the web-client by automation. But, able to logged in manually(able to view the home page without any issues).

Could you please help me to resolve this,

Reply
0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

prmsvm

I am glad that at least the manual workflow is working Smiley Happy

How did you login by automation in the previous Web Client versions? Did you use the special build provided by Laurent?

Reply
0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Thameemansari

Hi Themeem,

The same question to you:

Do you login using automation of manually?

Thanks,

~Peter

Reply
0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

This is the first time automating the VSphere web client using selenium SFAPI library.

Is any other way to get compiled SFAPI library(container-app-war) for vCenter 6.0.0 update 1.

Please help me on this.

Thanks in advance.

Reply
0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,

     Tried logging in manually, but in vain.

     Got the custom build for vSphere 5.5.1 from Rahul Dey of VMWare.

     Also able to do all the required operation using  custom build including Login.


Many Thanks,

Thameem

Reply
0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,


     Able to login through automation in custom build of vSphere 5.5.1.

     But unable to login even through manually, after replacing container_app.war of vsphere 6.0.1


Many Thanks,

Thameem

Reply
0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

Could you please tell me if there is any update/workaround on this.

Reply
0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Hi Thameem,

In 6.0 the login page has changed. Now it is no longer in Flex. If you inspect the browser element you will notice that the login page is in HTML.

This will require a change in your automation. And this is not related with the custom build.

Can you send me the compiled ui-swf.swf file? I will try it out to see why you can't login.

Thanks,

~Peter

Reply
0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

Is any other way to get compiled SFAPI library(container-app-war) for vCenter 6.0.0 update 1.

No, there is no other way.

Where do you get stuck? At the login page? Please check my reply to Thameem.

Reply
0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,

    Please find the compiled ui-swf.swf file with this thread.


Many Thanks,

Thameem

Reply
0 Kudos
prmsvm
Contributor
Contributor

Hi Peter,

The compilation of vCenter 6.0.0 update 1(VMware-VIMSetup-all-6.0.0-3040890 build) with SFAPI library got success. (In Home page using developer tools we are able to execute the command "container_app.doFlexType" is working).

Could you please help me how to identify the flex objects in VSphere web client.

Note:

1) I have tried using Monster Debugger tool to identify the flex objects, but it is unable to load VSphere web client in Monster Debugger tool application.

2) I have tried added "MonsterDebugger.swc" in pom.xml and get compiled container-app.war, but it is unable to load VSphere web client in Monster Debugger tool application.

Thanks in advance.

Reply
0 Kudos
Thameemansari
Contributor
Contributor

Hi Peter,

Good to go with installation of automation supported custom build for vCenter Server 6.0.0 Update1[Build#3018524] and able to automate components.

But facing the similar problem as another user replied in the forum i.e. Monster Debugger Tool is not identifying Vcenter Server 6.0 version.

Kindly let me know your thoughts on this.


Many Thanks,

Thameem



Reply
0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee

I am glad that it worked out!

Can you give me more details how what did you do:

  • Which version of the tool are you using? We are using version 3.0.0 internally.
  • Where did you get MonsterDebugger.swc from?
  • How did you installed it to the local repository?
  • How did you add the Monster Debugger to the container-app build? Can you send me the pom.xml?


Thanks,

~Peter

Reply
0 Kudos