How to Encrypt password for Selenium Webdriver

To secure our passwords we can use Base64 encoding scheme in Selenium WebDriver. We will import this Bas64 class in our script to get the decode password.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.By;
import java.util.Base64;

public class passwordEncryption(){

public static WebDriver driver;

String password = “simpletesters123”;

String encryptedPassword = Base64.getDecoder().decode(decodepassword.getBytes());

driver = new FirefoxDriver();
driver.findElement(“pass”)).sendKeys(“encryptedPassword “);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s