Feature: Test the login function
Scenario Outline: Test login function Given User open the Browser and navigated Then User enter and And Click the login button Then User navigated to FB home page
Examples:
| username | | password |
| asd | | 123 |
Error Given User open the Browser and navigated # stepDef.Testlogin.user_open_the_browser_and_navigated() Then User enter asd and 123 # stepDef.Testlogin.user_enter_username_and_password(java.lang.String,java.lang.String) io.cucumber.core.exception.CucumberException: Step [User enter (.) and (.)] is defined with 2 parameters at 'stepDef.Testlogin.user_enter_username_and_password(java.lang.String,java.lang.String)'. However, the gherkin step has 0 arguments. Step text: User enter asd and 123
Runner class file.
public class Testlogin { static WebDriver driver;
@Given("User open the Browser and navigated")
public void user_open_the_browser_and_navigated() throws IOException {
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-notifications");
driver =new ChromeDriver(options);
driver.get("http://www.facebook.com");
}
@Then("User enter (.*) and (.*)")
public void user_enter_username_and_password (String username,String password) {
System.out.println("The cell value is: "+username);
driver.findElement(By.id("email")).sendKeys(username);
//System.out.println("The cell value is: "+password);
driver.findElement(By.id("pass")).sendKeys(password);
}
@Then("Click the login button")
public void click_the_login_button() {
driver.findElement(By.name("login")).click();
driver.manage().window().maximize();
}
@Then("User navigated to FB home page")
public void user_navigated_to_fb_home_page() {
}