Confirm a password strength alert

75 views
Skip to first unread message

Ed R

unread,
Apr 25, 2014, 10:59:08 AM4/25/14
to seleniu...@googlegroups.com
Hi there,

I'm building a test using selenium IDE.

We have a page where you can set up users.  When you type in a password for a new user, we have a java script that reports on the strength of your password.  So if you type "m" as your password, you see this:

Strength: Too short

In selenium, I can assert that the element is there (Target: id=password_strength) but what I want is to assert or confirm the text "Too short"

So if I have "id=password_strength"  in the Target field and "kdjflks" in the "Value" field, selenium comes back green. 

Is there a way I can just confirm that the text "Too short" is there?

thanks,
Ed

Nagmani Kumar

unread,
Apr 27, 2014, 3:27:24 PM4/27/14
to seleniu...@googlegroups.com
...........



I think you need to see when too short will display , enter that value and then webelement text  "too short"

Doug Dragon

unread,
Apr 28, 2014, 1:29:18 PM4/28/14
to seleniu...@googlegroups.com
Hi Ed,
You'll likely want to find the element where "Too Short" will be listed and then do a "get_text' on that element and verify it contains the text "Too Short". I do something like this when I'm working with text verifications like that (in Python):

element = driver.find_element_by_css_selector("input#password_strength")
element_text = element.get_text
self.assertTrue(element == "Too Short", "%s does not match. Expecting "Too Short". Got %s") % (element, element_text)

Hope that helps,

-Doug
Reply all
Reply to author
Forward
0 new messages