How to encode password in Selenium.
Selenium does not have any inbuilt function to encode password unlike other tools i..e QTP etc.
So in order to hide password or encode password we have to use base64 java encoding/decoding & create a reusable funtion which can be used to encode/ decode a given string.
Code for encoing / decoding is -
So in order to hide password or encode password we have to use base64 java encoding/decoding & create a reusable funtion which can be used to encode/ decode a given string.
Code for encoing / decoding is -
// encode data using BASE64
byte[] bytesEncoded = Base64.encodeBase64("Password".getBytes());
System.out.println("ecncoded value is " + new String(bytesEncoded ));
// Decode data by processing encoded data
byte[] valueDecoded= Base64.decodeBase64(bytesEncoded );
System.out.println("Decoded value is " + new String(valueDecoded));
WebDriver Code -
Comments
Post a Comment