문제

다른 기능 내에서 오이 기능을 실행할 수 있는지 궁금합니다.예 :

@When("^I am at the User list page$")
public void I_am_at_the_User_list_page() throws InterruptedException {
    if(!driver.findElement(By.xpath("//a[contains(text(), 'User List')]")).isDisplayed()){
        driver.findElement(By.xpath("//td[contains(text(), 'Management')]")).click();
    }
    driver.findElement(By.xpath("//a[contains(text(), 'User List')]")).click();
    Assert.assertTrue("User list is showing", driver.getTitle().equals("Admin Portal -User list"));
    if(driver.findElements(By.xpath("//td[text()='\" + loginNewUserUsername() + \"']")).isEmpty()){
        //run.cucumber.feature(deleteuser.feature);//
    }
    driver.findElement(By.xpath("//a[contains(text(), 'Add User')]")).click();
    Assert.assertTrue("Entered Add User site", driver.findElement(By.id("editUserForm:changePasswordCheckBox")).isDisplayed());
}
.

도움이 되었습니까?

해결책

나는 그 일을 지저분하게해서 그렇게하지 않을 것입니다. 얽힌, 효과는 단계 (방법)를 호출하여 간접적으로 달성 할 수 있습니다.

if(...).isEmpty()){

  //call the methods/steps that makes up your feature/scenarios

  I_am_at_the_User_list_page();
  I_enter_username_as("blah");    
}
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top