i have a window who display few tabs, TC cannot recognize the tabs as a separate object but a one peace so, in order to click a specific tab i need to do it by using the relative position of the tab related to the window.
my questions are:
1.is there any option to make TC click this tab without using relative coordinates?
2.if the answer to question 1 is NO what function should i use to click the relative coordinates?
my script language is VBS
Thanks in advanced
One solution is to "tell" TC that your tab control is such. What it sounds like is that your tab control is a third-party control that TC is not "familiar" with.
In your project properties, there is a section called "Object Mapping". Under Win32 Controls and Windows, go down to Tab Control. If you have your application up, you can use the "Add From Screen" option to add your tab control to this part of your project. Or, you can manually enter the class name by using Add Class name.
The result should be that TC will then attempt to recognize your tab control as such and be able to interact with it that way.
Alternatively, the object has native properties and methods. While the control is not recognized as a tab control by TC, those methods will still operate. We ran into just such a situation in our office. The TAdvOfficePager is not recognized by TC. But the following VBScript code, essentially, executes a tab click (thanks to Jared from AQA support):
<font class="small">Code:</font><hr /><pre>Function ClickTab(wControl, ItemStr)
Dim TabId, oTab, TabCount
TabCount = wControl.AdvPageCount
For TabId = 0 To TabCount - 1
Set oTab = wControl.AdvPages(TabId)
If SameText(oTab.Caption, ItemStr) Then
ClickTab = True
ClickTab = False
End Function</pre><hr />
Syntax for use is
Set wControl = ' Obtain the control
If ClickTab(wControl, "My tab") Then ' success ...
You may have to utilize a custom routine like this but it works very well and simulates the scenario. It doesn't "record and playback" nice, but you'll should be able to replace your co-ordinate clicks in the code with the use of this routine.
Automated Testing Evangelists
Definition expert - noun - Unknown drip under pressure