Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 黄瓜和羔羊步防御_Java_Selenium - Fatal编程技术网

Java 黄瓜和羔羊步防御

Java 黄瓜和羔羊步防御,java,selenium,Java,Selenium,我已尝试获取某个功能的步骤。当我运行功能文件时,它会给我 差不多 Given("^I want to register into the main forum$", () -> { // Write code here that turns the phrase above into concrete actions throw new PendingException(); }); 这是一个lambda函数 我以前把它看作是一门课,如下所示 Class StepDefi

我已尝试获取某个功能的步骤。当我运行功能文件时,它会给我 差不多

Given("^I want to register into the main forum$", () -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
});
这是一个lambda函数

我以前把它看作是一门课,如下所示

Class StepDefinition{

    @Given("^I want to register into the main forum$")
    public void given(){

    }
}
但是我想知道如何使用这个lambda?我找到了答案

public void given(){
       Given("^I want to register into the main forum$", () -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
      });
}

然后将STS的java版本设置为
java8

,您可以通过提供用户名密码并单击“登录”来为代码设置登录主论坛的权限。