Ask a Question

Capture objects manually & write code using readily available methods.

SOLVED
sureshbl
Occasional Contributor

Capture objects manually & write code using readily available methods.

Hi Friends,
 
I like to do the following task using TestComplete tool.
 
1. I like to capture the objects on the web page manually say button, link or image etc.
2. Then, I like to write the code using readily available methods like "Click", "SetText" etc.,
 
I am using IE browser. How do we do that? 
 
Thanks,
SB
6 REPLIES 6
tristaanogre
Esteemed Contributor

1) https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/add/...

2) https://support.smartbear.com/testcomplete/docs/keyword-testing/index.html and https://support.smartbear.com/testcomplete/docs/scripting/index.html


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sureshbl
Occasional Contributor

Thanks Robert for your reply with lot of useful information. As I am new to this tool, still I am trying to understanding on capturing the objects and using the methods associated with that object. 

 

1. I am able to capture the object on the web page using "Object Spy" but trying to find the way to view all the methods for that object and use it.

 

I do not want to record the script and would like to write from the scratch like starting the

 

IE browser, navigating to the URL, click on the link, setting the text etc.,

 

Please find the attachment for details and help me.

 

tristaanogre
Esteemed Contributor

The links I gave for creating the scripts/tests tells you how to write them from scratch... what I linked was the top level overview of the topics which include BOTH recording and editing.

As for knowing what methods are available, mapping is one thing (that identifies the object).  When you are writing the automation, you will select the various methods that are needed.  When you map the object, there are settings that will store methods and properties for you to use then when developing the automation.

 

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/dial...

 

Using Brief or Full data will give you what you want.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sureshbl
Occasional Contributor

Thanks again!

 

As per my understand, we need to write the code manually starting from the top level hierarchy in TestComplete as below, right?

 

For example,

1. Aliases.Orders.MainForm.Exists() >> Here user using "Exists()" method which is readily available.
2. Aliases.Orders.MainForm.OrderBtn.Click() >> Here user using "Click()" method which is readily available.

 

If I have captured 10 objects for one of the test scripts in "Unit1" then, I need to write the code as in the example 1 and 2 starting from the top level heirarchy - "Aliases", right?

 

In the other test automation tools, if user selects object from the object map, right click and select the option "Insert at the cursor", the tool enters the code and automatically like "btnOK." when user enters "." after the object, it displays all the methods available. I asssume, this kind of option is not available in the TestComplete.

tristaanogre
Esteemed Contributor

No, that functionality does not exist in TestComplete in writing script code.

 

If you use Keyword tests (a visual WYSIWYG test designer), there's a bit more of that available.  You can select the "On Screen Action" operation which has a target redicule that allows you to select the object on screen (not from the repository).

 

As for writing it from then top level hierarchy, yes... unless you assign segments to variables.  Doing that, TestComplete is "smart" enough to recognize that it can grab information from the declared variable.

 

2019-09-05 14_25_40-TestComplete - C__MySource_Sandbox_Sandbox.pjs.png


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sureshbl
Occasional Contributor

Thanks for your quick responses with detailed explanation!

cancel
Showing results for 
Search instead for 
Did you mean: