Forum Discussion
Hi,
> how should we verify that.
Alas, web developers and web technologies are extremely ingenious these days in doing the same thing different ways. Even within one same web page.
To disable some web element, this element itself may be disabled. Or its parent. Or parent of the parent. Different class may be applied. Or some custom attribute or attribute's value and so on.
So you must either talk to developers and ask them how you can distinguish enabled element from disabled one or carefully inspect the element itself along with its parent(s) (if needed) in the Object Browser and figure out what makes this element to become disabled (state of some parent, class name, property, etc.) and use this finding in your code.
I tried checking in the TestComplete, when we are spying the object it is showing properties as Enabled = true even though on the screen the element is disabled.
className is slightly different for both, enabled element like class = "ui-button" and for disabled like class = "ui-button disabled"
- AlexKaras4 years agoChampion Level 3
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.
- Vars014 years agoOccasional Contributor
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;
...
Related Content
- 5 years agounderqualified
- 3 years agogoogleid_114550
Recent Discussions
- 2 days agovladd1