Reputation: 39
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?
Upvotes: 0
Views: 3023
Reputation: 1
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
Upvotes: 0
Reputation: 6573
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>
Upvotes: 2