Forum Discussion
Hi,
> still it is not working.
What exactly does not work?
Assuming that XPath-es are correct, I think that condition is missed for the Next_Button.
I would expect something like this:
...
var Next_Button = Aliases.browser.pageName.FindElement("//a[((contains(concat(' ',@class,' '),'ui-paginator-next ')) and not(contains(concat(' ',@class,' '),' ui-state-disabled')))]");
if (Next_Buton.Exists)
Next_Button.click();
else
hasNext = false;
...
AlexKaras The script fails as at the last page where the button is disabled also the TestComplete looks for the below object. It doesn't go inside else block
var Next_Button = Aliases.browser.pageName.FindElement("//a[((contains(concat(' ',@class,' '),'ui-paginator-next ')) and not(contains(concat(' ',@class,' '),' ui-state-disabled')))]");
- AlexKaras4 years agoChampion Level 3
Hi,
A side note: XPath is far not the best way to search for web elements in TestComplete's world unless you are considering cross-browser testing in the cloud (CrossBrowserTesting, BrowserStack, etc.). For the latter case you just have no other option.
> class = "ui-button" and when it got disabled the property is updated as class = "ui-button disabled"
Assuming I imagine the UI of your tested application correctly, you need to identify Next_Button using selector that does not rely on presence or absence of the 'disabled' substring in the value of the class property. Then you should check if class property contains 'disabled' substring, i.e. determine if the found button is enabled or not. And branch then appropriately.
- AlexKaras4 years agoChampion Level 3
Hi,
> at the last page where the button is disabled
The button that becomes disabled is Next_Button, isn't it?
If it is, have you tried my suggestion? Does it help?
- Vars014 years agoOccasional Contributor
The button is same which got disabled but the property is changed when it was enabled the property was class = "ui-button" and when it got disabled the property is updated as class = "ui-button disabled".
I tried your suggestion but the output was same.
Next_button has a property of enabled object.
If I need to consider these two properties separately then how should I put the same in the code. I tried considering two objects one for enabled button other for disabled button but as both the present in different pages. The script fails as TestComplete starts looking for both objects together in the same flow.
Related Content
- 5 years agounderqualified
- 3 years agogoogleid_114550
Recent Discussions
- 3 hours agoSubhraDas
- 22 hours agotramuntana