Forum Discussion
Vars01 :
Hi,
Can you provide a screenshot of the html markup for the table and several its rows? (Or copy-paste it from browser's Developer tools)
Complimentary screenshot from the Object Browser in TestComplete that corresponds to the same table might help as well.
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.
- Marsha_R4 years agoModerator
Even though it looks the same to you, the button probably has a slightly different object name on the other page. You might not be able to call it "x" all the way through the test. It might need to be Page1x and Page2x and you check for enabled separately for the two.
- Vars014 years agoOccasional Contributor
Thanks AlexKaras Marsha_R I tried giving two separate object name/xpaths but it is not working for me,in first page only it starts looking at both the objects and the script fails. It might be due to my lack of coding knowledge but I am not getting how should I use 2nd object name. Could you please tell me where should I put 2nd/disabled object/xpath in the below mentioned code. In the below mentioned code I am trying to get the row counts for all the pages.
function Test()
{var TotalCount;
do
{
var RowCount = Aliases.browser.pageSapiensDecision.FindElements("xpath for Rows");TotalCount = TotalCount+RowCount.length;
//Enabled Next button
var Next_Button = Aliases.browser.pageName.ObjectName;
Next_Button.click();
}while (Next_Button.Enabled == true)
Log.Message(TotalCount);
}
- AlexKaras4 years agoChampion Level 3
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.
Related Content
- 5 years ago
- 4 years ago
Recent Discussions
- 4 hours ago
- 6 days ago
- 10 days ago