Ask a Question

How can i shorten long object name (using TC 14).

Azeddin_Margani
Contributor

How can i shorten long object name (using TC 14).

Hi, 

 

Please advise on how can i shorten a long object id as below as it dynamically changes : 

Sys.Browser("chrome").Page("https://uat.testenviroment-test.com/customers/").Panel("portal").Panel(0).Panel(0).Panel(0).Panel(2).Panel(1).Panel(0).Panel(0).Panel(0).Panel(1).Panel(0).Panel(1).Panel(0).Panel(0).Button(0)

 

Tried to use wild card (*) but getting red cross against the same line. The idea is to tell TestComplete to ignore what is after wild card *.

 

Many Thanks. 

Az.

A.M.
5 REPLIES 5
Marsha_R
Community Hero

You don't say which part changes, but I'm going to go with the URL being stable.  I would define a variable with a short name to be equal to your URL string and then use the variable in the page name.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

Hi Marsha, 

 

The part that keeps changing is highlighted in blue: 

Sys.Browser("chrome").Page("https://uat.testenviroment-test.com/customers/").Panel("portal").Panel(0).Panel(0).Panel(0).Panel(2).Panel(1).Panel(0).Panel(0).Panel(0).Panel(1).Panel(0).Panel(1).Panel(0).Panel(0).Button(0) 

 

Please provide with illustrative example in here. 

I would like to achieve 2 things if possible: 

1. To shorten this object id. 

2. To use a wild card on the these panels as they keep changing. 

 

Many Thanks, 

Az.

A.M.

Try

Sys.Browser("chrome").Page("https://uat.testenviroment-test.com/customers/").Panel("portal").*.Button(0) 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame

Hi, 

Do i need to declare the use of * anywhere in TestComplete because it tells me Unexpected Token *.

 

Azeddin_Margani_0-1634115040259.png

 

Thanks,

Az.

A.M.

Hi @Azeddin_Margani - 

 

Yes - the wildcard should be applied from within the NameMapping section. To accomplish this you would first add the element to your repository and then map it based on the property you have listed with the wildcard in the property portion of the NameMapping area.

 

ebarbera_0-1639163615439.png

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

 

Let me know if you have any other questions. 

 

Emma

cancel
Showing results for 
Search instead for 
Did you mean: