Я новичок в Selenium Webdriver с интеграцией в Cucumber и не могу успешно войти в систему.
Вот мой файл функций:
Feature: Validate user can login successfully
@tag
Scenario: Successful login
Given User is on the Login screen
When User enters UserID and Password
And User clicks Login button
Then Home Page is successfully displayed
Вот мое определение шага:
public class Steps
{
WebDriver driver;
@Given("^User is on the Login screen$")
public void User_is_on_the_Login_screen() throws Throwable
{
System.out.println("Pumasok dito");
//OPEN THE BROWSER
System.setProperty("webdriver.chrome.driver", "C:\\Users\\I689629\\eclipse-workspace\\uat-core\\src\\test\\resources\\drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://go/eruat8");
throw new PendingException();
}
@When("^User enters \"(.*)\" and \"(.*)\"$")
public void User_enters_UserID_and_Password() throws Throwable
{
//ENTER THE FID
driver.findElement(By.id("txtUserDefault")).sendKeys("User123");
//driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
//ENTER THE PASSWORD
driver.findElement(By.id("txtPassDefault")).sendKeys("Password123");
}
@And("^User clicks Login button$")
public void User_clicks_Login_button() throws Throwable
{
//CLICK THE LOGIN BUTTON
driver.findElement(By.xpath("//*[@id=\"frmDefault\"]/div[1]/div[2]/div[2]/div[2]/input")).click();
//}
}
@Then("^Home Page is successfully displayed$")
public void Home_Page_is_successfully_displayed() throws Throwable
{
System.out.println("Home page is displayed");
}
}
И вот мой тестовый бегун:
@RunWith(Cucumber.class)
@CucumberOptions(plugin = { "pretty", "html:target/cucumber-html-report", "json:target/cucumber.json" },
features = {"src/test/resources/features" }, glue = { "StepDefinition" })
public class TestRunner
{
}
Может кто-нибудь помочь мне, пожалуйста. Спасибо.