abhishek1997
2 years agoContributor
How to verify if a web element is selected or not
Hello Team,
How to verify if a web element is selected or not. For example, see the attached screenshot. If Button A is clicked Label A will be selected. So we have to verify the whether Label A is selected or not.
I have searched in TestComplete Documentation, unlike selenium there is isSelected() method, but I did not find anything like that with TestComplete. Could you please help me regarding this question ??
I tried in different way, it worked for me
def isSelected():
ele = homePage.FindElement("xpath")
eleClass = str(ele.getAttribute("class"))
if "highlighted" in eleClass :
Log.Message("The element is selected")
else:
Log.Message("The element is not selected")