Forum Discussion
Hi,
> enabled element like class = "ui-button" and for disabled like class = "ui-button disabled"
And this is the key for your case.
To distinguish between enabled and disabled button you must check if the value of the 'class' property contains 'disabled' substring.
AlexKaras I have tried the below code but still it is not working. I might be doing something wrong but now sure what it is. Can you please have a look,
function Count()
{
var Row;
var TotalCount=0;
var hasNext = true;
do
{
Row = Aliases.browser.pageName.FindElements("//span[@class='className']");
TotalCount = TotalCount + Row.length;
if(Aliases.browser.pageName.FindElement("//a[((contains(concat(' ',@class,' '),'ui-paginator-next ')) and not(contains(concat(' ',@class,' '),' ui-state-disabled')))]").Exists)
{
var Next_Button = Aliases.browser.pageName.FindElement("//a[((contains(concat(' ',@class,' '),'ui-paginator-next ')) and not(contains(concat(' ',@class,' '),' ui-state-disabled')))]");
Next_Button.click();
}
else
{
hasNext = false;
}
}while (hasNext=true)
Log.Message(TotalCount);
}
- AlexKaras4 years agoChampion Level 3
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;
...
- Vars014 years agoOccasional Contributor
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,
> 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?
Related Content
- 5 years agounderqualified
- 3 years agogoogleid_114550
Recent Discussions
- 3 days agovladd1