Forum Discussion
I disagree with this opinion ^^. Xpath is great thing and the most reliable (and faster) method to get any object on a web page. But, since TC only support Xpath 1.0 syntax, it requires some tricks to built it in the right way.
For exemple in this page (the TC forum page where we are) the button "Reply" has a part generated in its id. its look like this :
//input[@id="submitContext_75b1b600eccb34_0"]
To get the button in the right way, We must identify the others components in the page and use some of them as "checkpoint" to be sure that we get the button always in the same way.
so the xpath become : //div[contains(@class, 'lia-inline-message-reply')]//div[contains(@class, 'lia-form-submit')]//input[@value='Reply']
in this way we get the reply panel, then the button group, and finally the reply button. As long as the architecture of the TC website (and/or css) doesn't change, this path is always the same.
namemapping is great too, but it can be pretty tricky to maintain when we have dozens of objects. Xpath is much more simpler.
> Xpath is great thing and the most reliable (and faster) method to get any object on a web page.
Actually, native TestComplete's object identification is much more functional and handy.
The only problem is that it will not work if the test is executed under Appium control (this is the case when TestComplete tests are executed on iOS, Android). So, if there is a chance that your tests will be executed not only on Windows, you have no other choice but use XPath.
If your tests are for Windows execution only, than native object identification is much better choice.
P.S. I would hope that SmartBear can make native NameMapping to be compatible with non-Windows environments, but I am afraid that this might be not worth required efforts... 😞
Related Content
- 5 years ago
- 7 years ago
Recent Discussions
- 27 days ago
- 5 days ago
- 5 days ago
- 8 days ago