How can I check if the show password functionality is working or not? What property of check box I should after clicking on 'show password' checkbox to confirm the test written in password field is visible?
Asked
Active
Viewed 2,596 times
0
-
Is that eye icon you want to click on..? – PySaad Jul 28 '17 at 06:18
-
i have clicked on the check box to show the password. i want to make know how to make usre if the content in password is visible or not – Abhimanyu Singh Jul 28 '17 at 06:20
-
Possible duplicate of [Selenium checkbox attribute "checked"](https://stackoverflow.com/questions/8187772/selenium-checkbox-attribute-checked) – Atilla Arda Açıkgöz Jul 28 '17 at 06:21
-
So, you mean. You script is running fast and you can't verify whether it clicked on show password or not..? – PySaad Jul 28 '17 at 06:22
-
the scenario is I am entering a value in password field lets say 'abcd' it is coming as XXXX in the text box. now i checked the 'show password' check box. And now i can see the password entered as 'abcd'. but I ma not sure which property of test box (to write the script) i should use to confirm if the password is visible or not in actual to the users – Abhimanyu Singh Jul 28 '17 at 06:26
2 Answers
2
This is a simple logic you can implemented based on your needs
function togglePassword(checkbox){
if(checkbox.checked == true){
document.getElementById("password").type = "text";
}else{
document.getElementById("password").type = "password";
}
}
<input type="password" id="password" name="passwod" />
<label><input onchange="togglePassword(this)" type="checkbox" /> Show</label>
If you want to use checkbox means
function togglePassword(checkbox){
if(checkbox.checked == true){
document.getElementById("password").type = "text";
}else{
document.getElementById("password").type = "password";
}
}
<input type="password" id="password" name="passwod" />
<label><input onchange="togglePassword(this)" type="checkbox" /> Show</label>

yasarui
- 6,209
- 8
- 41
- 75
0
I android devices while doing automation testing, Sometime, Functionally it return the password filed is hidden but in UI actually not. Try this
Capture screenshot of password filed and compare with UI screenshot image(take manually and store it OS)
Capture SS and read texts in that image, If that texts match with right password which is given in code then test passed.
Use CV2 and pytesseract

Ram
- 1