Encoding and Decoding in Selenium using Base64 Class of Java
What is Base64? Base64 is an encoded scheme that converts binary data in to text format so that encoded textual data can be easily transported over network un-corrupted and without any data loss. Simple Program: package encodeAndDecode; import java.util.Base64; public class EncodeText { public static void main(String[] args) { // TODO Auto-generated method stub String username = "mercury" ; // Encode Username byte [] encodedByte = Base64.getEncoder().encode( username .getBytes()); String encodedText = new String( encodedByte ); System.out.println( "Encoded Username : " + encodedText ); //Decode Username byte [] decodedByte = Base64.getDecoder().decode( encodedByte ); String decodedText = new String( decodedByte ); System.out.println( "Decoded Username : " + decodedText ); } Output: Encoded Username : bWVyY3VyeQ== Decoded Username : mercury Usage In Selenium: We can keep the encoded data ...