Sunday, November 27, 2011

Webdriver - Drop down select values

Webdriver - Drop down select values. (IE Driver)

There is no direct method to choose/click the values from the drop down.
I have used following code to select the list values. Also attaching the screen shot of the list box HTML for better understanding.


String UOMCode = "A1";
driver.findElement(By.xpath("//select[@id='ddlUOM']/option[@value='"+UOMCode+"']")).click();

Also read following post
http://bharath-marrivada.blogspot.in/2012/03/webdriverselenium2-listboxselectdropdow.html

----

Monday, November 21, 2011

VB Script - Call Web-Service with parameters as inline attachment (Base 64)

This summary is not available. Please click here to view the post.

Thursday, November 17, 2011

Selenium - Build standalone jar file using ANT



  
  Selenium RC Common Build Tasks
 
  
  
  
  
  
  
  
   
 
 
  
  
  
  
  

  
    
   
   
   
  

  
   
       
     
  
  
    
   
    
      
    
  

  
    
    
       
    
    
      
        
        
        
        

Tuesday, November 15, 2011

QTP, Selenium - Black/Empty screen shots - Windows

QTP, Selenium - Black/Empty screen shots - Windows



Black screen shot happen when desktop is not available. This will happen when you lock the PC, disconnect or minimize RDP (Remote Desktop). This is fail windows screen shot function, any tool need to relay on OS APIs for taking a screen shot. It is a known issue in all versions of windows.
Also some of the tool functions fail because windows switches to GUI-Less mode and don't display windows and controls.

There are FOUR options available

Option1: When tool is installed on local machine, install caffeine so that your system is not locked automatically when ideal as per the company policy.

Option2: Install  Ultra VNC Server on the remote machine or EC2, so that it can be accessed by IP address. In this option you can lock the machine with VNC on, still you can take the screen shot.

Option3: http://blog.smartbear.com/post/10-10-11/testcomplete-tip-running-tests-in-minimized-remote-desktop-windows/
The Microsoft Windows operating system includes the Remote Desktop component that allows you to connect to a remote computer and work with it as with your local computer. This is a common way to run and monitor automated tests on remote computers: you connect to the test computer using a Remote Desktop Connection (RDC) and use the Remote Desktop window to work with the remote computer on your PC.
There is a pitfall using this scenario: you may not minimize the Remote Desktop window (that is, the window which displays the remote computer’s desktop), or your GUI tests will fail. If you minimize this window, the operating system switches the remote session to a GUI-less mode and does not display windows and controls. As a result, TestComplete (or TestExecute) are unable to interact with the tested application’s GUI as the GUI doesn’t actually exist in this case.
Keeping the Remote Desktop window visible may be inconvenient, as it will occupy some part of or even your entire screen, and you will have less space for running your local applications.
We have found a way to bypass this limitation. The workaround is simple: you need to change Registry keys on your computer (that is, the computer from which you connect to a remote TestComplete or TestExecute workstation). Here is a step-by-step description:
  1. Close Remote Desktop sessions opened on your computer.
  2. Launch the Registry editor (Regedit.exe).
  3. Locate any of the following Registry keys:
    • HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\
      (if you want to change the RDC settings for your user account)
    • -- or --
    • HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\
      (if you want to change the RDC settings for all accounts)
       
  4. Create a new DWORD value in this key namedRemoteDesktop_SuppressWhenMinimized. Specify 2 as the value data (As Decimal).
  5. If you use a 64-bit operating system, add the RemoteDesktop_SuppressWhenMinimized value to the following keys under the Wow6432Node node:
    • HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Terminal Server Client\
      (for your user account)
    • HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client\
      (for all user accounts)
    This way the Registry tweak will work in both 32- and 64-bit versions of the Remote Desktop client.
That’s all. Now minimizing the RDC window on your computer will not affect the remote computer’s GUI and the GUI will still be available to your automated GUI tests.

Option 4:http://test-automation-solutions.blogspot.com/2010/09/run-gui-autotests-on-remote-server.html

Here is the simple, but very useful instruction how to run GUI test automation scripts on the remote server.

1. Open "Remote desktop connection" window, click "Options" button, then "Save As..." and save "*.rdp" file in any place. 
2. Open *.rdp file in Notepad and add to the end of file string: "smart sizing:i:1" without quotes. Make sure that parameters "desktopwidth:i:1280" and "desktopheight:i:1024" has values which match desktop resolution on a server. If you wish, you can change parameter value "session bpp:i:8" to "session bpp:i:24" for more comfort colors. 
3. Use this *.rdp file for launching RDC session by clicking on it. 

After tests launch on the remote server you can change size the RDC Session window, but don't minimize and don't overlap it with another windows - it is very important. 

Optional: for keeping RDC Session window always on top, you can use free software "Hotkey manager"  http://www.killprog.com/hkme.html. After install "Hotkey manager" run it, icon appears in system tray, then hold Ctrl button and right-click on "Maxmimize" button on RDC Session window, RDC window becomes always on top. For keeping window always on top, you can use other software too or just control it manually. 

In order to keep RDC closed, you can set specific registry values, as it is described at Running Tests in Minimized Remote Desktop Windows article.

----