【发布时间】:2020-11-16 22:26:41
【问题描述】:
public class Login_Applicant_StepDef {
WebDriver driver;
@Given("^the URL$")
public void the_URL() throws Throwable {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\SSMP\\Downloads\\chromedriver_win32\\ChromeDriver.exe");
driver = new ChromeDriver();
driver.get("http://localhost:4200/app-home");
}
@When("^Click on the Applicant Click here button$")
public void click_on_the_Applicant_Click_here_button() {
driver.findElement(By.xpath("//a[contains(text(),'Candidate click here')]")).click();;
//JavascriptExecutor jvs= (JavascriptExecutor)driver;
//jvs.executeScript("argumnets[0].click()",emailBtn);
}
@Then("^user will navigate to login Page$")
public void user_will_navigate_to_login_Page() {
driver.navigate().to("http://localhost:4200/candidate");
}
@Then("^enter valid \"([^\"]*)\"$")
public void enter_valid_email(String email) {
driver.findElement(By.xpath("//input[@id='mat-input-0']")).sendKeys(email);
}
@Then("^click on Submit button$")
public void click_on_Submit_button() {
driver.findElement(By.xpath("//span[@class='mat-button-wrapper']")).click();
//JavascriptExecutor js= (JavascriptExecutor)driver;
//js.executeScript("argumnets[0]..click()",loginBtn);
}
}
我创建了两个功能文件和步骤定义,现在有 1 个功能文件和步骤定义链接到 TestRunner。如何将多个 FF 和 Stepdef 链接到测试运行器 另外,尽管我添加了示例,但程序没有运行
@App_login
Feature: Optevus Applicant Login Feature
Scenario Outline: login with valid Credentials
Given the URL
When Click on the Applicant Click here button
Then user will navigate to login Page
Then enter valid "<email>"
Then click on Submit button
Examples:
| email |
| kallursh@gmail.com |
| kallurishar@gmail.com |
【问题讨论】:
-
请用代码替换截图。
标签: java selenium cucumber bdd gherkin