Password field visibility

I’m trying to write a test to detect if the password field visibility is on or off. Has anyone had to do this? If so, are there any recommendations on how to do it?

Thanks

hello,

what about this page

I think what you’re asking about is whether the content of the field is readable by a human: e.g. mypassword instead of **********

Whether a web page offers that capability is down to the medium (OS/platform) where the browser is running. That’s to say, it’s not something a web page author can sepcify directly in HTML in a regular HTML <input type="password"> element (or even in JavaScript). That being the case, if your web page is using a regular HTML password field, you won’t be able to test it.

The web page I am testing has the ability to toggle the password visibility on or off. Inside the HTML code, there seems to be a value of some kind that toggles between “visibility” and “visibility_off”. Is there a way to capture that?

Interesting - then it’s not a standard HTML password element (the give away is two things: there’s no mention of it in the specs AFAICT, and that underscore in “visibilty_off” - HTML and css tend to use hyphens).

Can you capture the render in DevTools and post it here? Or paste the HTML…

No problem. I think I found a way around it. Thanks for the help!

@tim.hatcher will be nice to hear what solution you found.
what i have in mind is … provided you can accurately locate the element position on the screen, make a screenshot of it and OCR-it …

1 Like