cancel
Showing results for 
Search instead for 
Did you mean: 

SWTObject support

Highlighted
New Contributor

SWTObject support

Hello,



I'm trying to test an SWT Open application.  The tab control, which I am trying to use, has the following full name:



Sys.Process("Process").SWTObject("Shell", "Application").SWTObject("Composite", "", 5).SWTObject("Composite", "").SWTObject("CTabFolder", "", 6)



Inside this control are 4 tabs, which can be in any order.  There are several methods which are available, but I cannot find a method where I can specify the tab name or index, in order to click the tab.  Is there a way to do this for an SWTObject? (The WndClass is SWT_Window0.)



Thanks!



Brett
3 REPLIES 3
Highlighted
New Contributor

RE: SWTObject support

Does anyone have any suggestions?  I'm using TestComplete 7.5.



Thanks!



Brett
Highlighted

RE: SWTObject support

Hello Brett,




You can use native Java properties and methods of the CTabFolder control to accomplish your task. Here is an example demonstrating how to click a tab by its name:




[JScript]




function Test()

{   

  var obj = Sys.Process("Process").SWTObject("Shell", "Application").SWTObject("Composite", "", 5).SWTObject("Composite", "").SWTObject("CTabFolder", "", 6);

  

  ClickTab(obj, "Tab 2");                   

}




function ClickTab(objCTabFolder, strTabName)

{         

  count = objCTabFolder.getItemCount(); 




  for (var i = 0; i < count; i++)

  {

      TabItem = objCTabFolder.getItem(i);

      

      if (TabItem.text == strTabName)

      {         

        objCTabFolder.Click(TabItem.x, TabItem.y);

      }

  }     

}

--
Dmitry Nikolaev

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
New Contributor

RE: SWTObject support

Thanks for the update, this worked great.
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors