cancel
Showing results for 
Search instead for 
Did you mean: 

Finding an object when form name changes but every form has the same object

SOLVED
Highlighted
Occasional Contributor

Finding an object when form name changes but every form has the same object

Hello,

   This explanation may be poor but I am trying to script this for the first time.

I have an object that I need to interact with regardless of what form I am on. I have tried to use the example provided by support but I cannot get it to work. There is a label on every form in our application that when click can navigate to the main form of the application.  

 

Sys.Process("Signon").WinFormsObject("#######").WinFormsObject("LeftPanel").WinFormsObject("labLogo")

 

The WinFormsObject("######") changes with every form but it is always the ending WinformsObject("labLogo"). When I use Find it finds the object but on the Sys.Process("Signon"). I need it to find the object on whatever the current form is and take action against it. I have tried everything I could think of using the support and community to no avail.  I am using VBScript if that changes anything.

 

Thank you for any help!!!

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

Hi,
It will be very easy for you if you use NameMapping inside TestComplete.

It is not recommended to use Sys. to write scripts in TestComplete,

 

Use NameMapping -> modify recommended property with (use wild cards):

https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

 

Also,

Use .Find() on the selected object to avoid performance problems. It is not recommended to start the search process from the beginning of the program object structure.

 

Debug 🐛this piece of code and change parameters. This is the key to success.

View solution in original post

2 REPLIES 2
Highlighted
Occasional Contributor

Additional info:

 

This is the sample I am trying to use and I feel like my issue is with the "Set p =". I have tried to use wild cards like (Sys.Process("Signon").WinFormsObject("*").WinFormsObject("LeftPanel").WinFormsObject("labLogo")

but that does not work. I have also tried findChild but it still finds the wrong control and cannot access it because it is not visible.

 

sub findTest
Dim p, control
' Searches for the control
Set p = Sys.Process("Signon")
Set control = p.Find("WinFormsControlName", "labLogo", 1000)
' Processes the search results
If control.Exists Then
Log.Message control.FullName
Else
Log.Error "The object was not found."
End If
End Sub

Highlighted
Community Leader

Hi,
It will be very easy for you if you use NameMapping inside TestComplete.

It is not recommended to use Sys. to write scripts in TestComplete,

 

Use NameMapping -> modify recommended property with (use wild cards):

https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

 

Also,

Use .Find() on the selected object to avoid performance problems. It is not recommended to start the search process from the beginning of the program object structure.

 

Debug 🐛this piece of code and change parameters. This is the key to success.

View solution in original post

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 and get into the Leaderboard!


Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

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

Participate!

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

Participate!
Top Kudoed Authors