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

I ended up using WebUI.getAttribute to pull the text out of “textContent” and then uses verifyMatch.

1 Like

That’s bad.

Not you or what you’re doing, Tim.

There is no such attribute as textContent - it’s a property retrieved via an entirely different web api.

One more case where Katalon (Selenium?) fudges over the difference. In this case it doesn’t matter much, but elsewhere it does. :angry:

I guess I am not sure why it worked, but it did. All other attempts to pull out tooltip text failed.

It worked because they’re fudging the difference between two very different things.

element.property

   e.g. my_element.value

and

element.getAttribute(attribute_name)

   e.g my_element.getAttribute("value")

are not considered the same thing - nor should they be for good reason. Doing that with the textContent property is probably benign. But doing robust testing of some web properties is not possible with Katalon as a result (at least, last I checked).