Java Faker in Selenium 1722067816
Java Faker in Selenium 1722067816
com/in/gayatri-mishra-freelancecoach/
Scenario -1 :
Steps:
a. Launch rediffmail
b. Enter UserName
c. Enter Password
Sample Code :
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import com.github.javafaker.Faker;
// Find the username and password input fields and enter the generated
// credentials
WebElement userid = driver.findElement(By.name("login"));
WebElement passcode = driver.findElement(By.name("passwd"));
userid.sendKeys(unm);
passcode.sendKeys(pwd);
driver.quit();
https://www.linkedin.com/in/gayatri-mishra-freelancecoach/
}
}
Scenario -2 :
Steps:
a. Launch rediffmail
b. Enter UserName
c. Enter Password
d. Clear and reenter with 3 different set of test data using Faker library
package co.content.linkedin.co.content.linkedin;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import com.github.javafaker.Faker;
// number of iterations
static int niter = 3;
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version> <!-- Check for the latest version on Maven Central -->
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
https://www.linkedin.com/in/gayatri-mishra-freelancecoach/
<version>4.16.1</version>
</dependency>