Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled:True/False is not working (selenium) #1377

Closed
MeghaPrakash1992 opened this Issue Dec 14, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@MeghaPrakash1992
Copy link

MeghaPrakash1992 commented Dec 14, 2015

case "enabled": Func_FindObj(ORvalname, ORvalue);
boolval = elem.isEnabled();
System.out.println(boolval);
actval = boolval.toString();
System.out.println(actval);
break;
I am doing keyword driven automation testing using selenium open to test frame work. I write the web page elements and their path in one file and the actions to be performed on them in the other. I am supposed to check if the link is enabled for a particular kind of user or not. I am using this method to check that. But 'boolval' always returns 'true' for any given link no matter it is enabled or disabled. Is there any other way to check if the link is enabled. If not in-built can we write our own method to check?
The only difference between the enabled and disabled element is the presence of 'href' in the anchor tag and the name of the class.

@stupidnetizen

This comment has been minimized.

Copy link

stupidnetizen commented Dec 14, 2015

I think Selenium would verify with the value of disabled attribute. However, I am not sure whether disabled:true stands valid for anchors. May be you need to choose another attribute to verify disabled anchors. Did you try disabled: disabled ??

@ddavison

This comment has been minimized.

Copy link
Member

ddavison commented Dec 14, 2015

according to the W3C, links are excluded from elements that can be disabled. Buttons are able to be disabled, but not links.

In order to test that links are disabled, you cannot use isEnabled() as this, by requirement, only checks the disabled attribute on input elements, buttons, textareas and the like.

If you need to validate that the link is enabled, then you need to find another way.. it most likely is defined by a class, so you should check that the element exists with a class disabled. It's your responsibility to see which class enables that behavior.

Please see this as a reference #1348 A similar discussion had taken place.

@ddavison ddavison closed this Dec 14, 2015

@MeghaPrakash1992

This comment has been minimized.

Copy link
Author

MeghaPrakash1992 commented Dec 17, 2015

@stupidnetizen : I checked... Its not there in my framework so Disabled:disabled doesn't work. If you are saying that there is an inbuilt function to check if the link is disabled: No, it is not there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.