Forum Discussion
Hello Shankar,
Thanks for your reply. I am not sure why we need to create a dummy object instead why can't we use the mapped or named object hierarchy and use regular expression to achieve the desired result.
Also,creating the dummy objects and working on it will be additional task and time consuming. I require a good solution on this.
Apart from this, I was evaluation the option to pass the object to the function ClickButton but that is also not working.
I tried to create the object as Set obj= Aliases.browser.page.button and pass obj in to the ClickButton Sub routine with a statement to click the object but that is also not working. I tried using the map object : Set obj=Sys.browser.page.button but that is also not working.
Right now, I am clueless on how to create custom sub routines for basic task such as click button, set the text box value etc.
Regards,
Nimish
I guess, you want your descriptive programming without having any NameMapping predefined.
I personally would not recommend to go without NameMapping since you can not achieve 100% without NameMapping.
Also, TestComplete provide massive options in the NameMapping which ease our automation.
- nimishbhuta7 years agoFrequent Contributor
Yes. I dont want to use the NameMapping but the example you should involves NameMapping for creating a dummy object.
I don't want to go through NameMapping or Mapped object just directly referring to the object through it's property.
Please let me know if it can be achieved or not.
Regards,
Nimish
- tristaanogre7 years agoEsteemed Contributor
Why do you not want to use NameMapping? This is the primary and preferred/best practice method for object identification in TestComplete. It abstracts the UI object identification from your code so that you can alter your object identification without needing to affect your code (that's the beauty of Aliases). You are using TestComplete, not UFT... So, you may need to adapt your automation techniques to the tool.
TestComplete does not allow you to over-ride/overload/replace the "Click" methods with your own... you still need to work with TestComplete's "Click".
If you WANT to construct your own object identification layer in code, you will want to use liberally the FindChild, FindAllChildren, FindChildEx, etc., methods... but they require you to start with The basics of the AUT... Sys.Process('myapp') or Sys.Browser(<browsername>)... but you're going to lose performance... Finding objects and using any code techniques to construct and recognize objects in code is going to SEVERELY slow your test cases because you will need to search for the object EVERY time... while NameMapping caches much of the information and is internal code logic of the Tool rather than "interpreted" script code... it natively runs faster.
So.... back to question 1: Why do you want to avoid using NameMapping when, for the tool you have selected to use, it is the best practice for the tool?
- nimishbhuta7 years agoFrequent Contributor
Thanks Robert for your reply.
In the NameMapping way of object identification,I can't use descriptive way of accessing the object. I will explain you why I need to have descriptive way of access is that I need to have subroutines which are generic and not tied up with NameMapping.
For Ex: I want to create customized Click Button subroutine,so that I can put some customized code like first checking the object exist or not and then add some reporting code.
In UFT, we used to this way sorry for going back to UFT, where we are aware that that we can access the property using descriptive programming and once we create this, we are not concerned about the object repository or in TestComplete case it is NameMapping.
Sub ClickButton(btName)
If Browser("name:=.*").Page("title:=.*").WebButton("name:"=btName).Exist() Then
Browser("name:=.*").Page("title:=.*").WebButton("name:"=btName).Click
End If
End Sub
In the above code, I need just pass the button name and that's it, this will work on any web page or button, so it is application independent and more useful in organizing subroutines or function.
Regards,
Nimish
Related Content
- 4 months ago
- 6 years ago
Recent Discussions
- 2 hours ago
- 6 hours ago