Password Encryptor for Selenium Webdriver


By using this Password Encryptor, we can secure the password.Its so simple to Encrypt.

import java.util.Base64;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
public class PasswordEncryptor {
WebDriver driver;
static String decodepassword=”aGFwcHltYW4xNjM=”;
public static String getDecodedpassword()
{
return new String(Base64.getDecoder().decode(decodepassword.getBytes()));
}

@Test
public void test1()
{
System.out.println(getDecodedpassword());
driver=new FirefoxDriver();
driver.get(“https://accounts.google.com”);
driver.findElement(By.id(“Email”)).sendKeys(“testerTest@gmail.com”);
driver.findElement(By.id(“Passwd”)).sendKeys(getDecodedpassword());
driver.findElement(By.id(“signIn”)).click();

}

}

Advertisements

4 thoughts on “Password Encryptor for Selenium Webdriver

  1. Anonymous June 3, 2015 / 12:46 pm

    This is cool !!

    Like

  2. armatearjun June 15, 2015 / 12:53 pm

    What is the java version supported for base64, if i try importing import java.util.Base64; import cannot be resolved error is coming, so tried using instead import org.apache.commons.codec.binary.Base64;, but no luck, i am using JRE7 in buildpath… Any help will be appreciated…

    Like

    • charan163 June 15, 2015 / 2:47 pm

      I am using JAVA- version 8

      Liked by 1 person

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s