Forum Discussion
Thanks for the reply. It worked for me I am able to select the desired row and click on it. I have used do while loop so if the condition is false then also the element should be verified once.
I have one additional doubt here - if we have button which is enabled in one screen but disabled in another screen how should we verify that. I am putting a condition in while loop as mentioned "while(x.Enabled == true)". but my loop is not stopping even though the button has become false. Is there any solution to check this.
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.
- Vars014 years agoOccasional Contributor
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);
}
Related Content
- 5 years agounderqualified
- 3 years agogoogleid_114550
Recent Discussions
- 21 minutes agoDSmachineWorld
- 8 hours agoSvetaG