Forum Discussion

swapnalinarkar's avatar
swapnalinarkar
Occasional Contributor
10 years ago

Unable to recognize child objects of Java SWT Application


Hi,

I am using testcomplete tool for dsktop application. GUI of the application is built in JAVA (SWT).
I am facing an issue that 'Child objects of application are not able to recognize using Object spy'
This issue is for few scenarios for Ex:When application is having values in Grid format.
When I use 'Object Spy' on this grid, shows Childcount as '0' however there are values in the grid in form of row,column.

 

If I record the script using (Jscript) values get detcted in form of 'pixel' click.

I am not able to recognize these values in form of there names.

 

Can anybody suggest solution.

I had gone through help topics as 'Testing Java Applications'but could not solve the probelm

 

Testing Details:
Java version:1.7.45
TestComplete Tool version: 10.3
Launched TestComplete tool as 'Run as Administrator'

 

Checked that below Plugins are installed.
- Java Application Support.
- Open Applications;
- Desktop Applications Testing.

 

 

  • HKosova's avatar
    HKosova
    10 years ago

    It seems to be a Nebula Grid control. If so, you can get data from this grid and interact with it using the grid's internal methods and properties - those under the Java category in the Object Browser.

    For example, to get the grid data:

     

    // JScript
    var grid = ...; // "path" to your grid object
    
    var nRows = grid.getItemCount();
    var nCols = grid.getColumnCount();
    
    var value;
    for (var i = 0; i < nRows; i++)
    {
      Log.Message("Row " + i);
      for (var j = 0; j < nCols; j++)
      {
        value = grid.getItem(i).getText_2(j).OleValue;
        Log.Message(value);
      }
    }

     

    To expand or collapse a row:

     

    gridObj.getItem(index).setExpanded(true);
    
    gridObj.getItem(index).setExpanded(false);

     

    • swapnalinarkar's avatar
      swapnalinarkar
      Occasional Contributor

      Hi

      Our application uses SWT/Jface grid (Standard type) which is based on Java API.

      I got solution on detecting the text on this grid by using the setting which is mentioned in below blog.

       

      http://www.testmanagement.com/blog/2013/08/text-recognition-for-test-automation/

       

      Now I am able to detect the text on this grid however I am not able to perform the operation on this grid.
      For Ex: To Expand the grid I need to click to the '+', '-' Image which is displayed beside to this text.

      I am not able to detect and click these Images.Also I want to access the content of this grid columnwise or rowise.

       

      I have attached screenshot of the grid.

      GridImage

       

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        What's the JavaFullClassName property of your grid?