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.
I tried to create an "If ... Then" so that IF this window exists it will do theses steps and then an ELSE to do this steps if the first condition was not meant.
Is this the correct way to write it? Equals exists? so if Browser.TestTemplateDetails exists it will continue with "If ... Then" if it doesnt exist it will continue with "ELSE".?
Related Content
- 5 years ago
- 7 years ago
Recent Discussions
- 27 days ago
- 5 days ago
- 5 days ago
- 8 days ago