首页 > 解决方案 > 如何在黄瓜范围报告中显示动态值

问题描述

我想在黄瓜范围报告中显示动态值

前任:

特征文件

给定输入用户标识为 <"userid">

并输入当前时间为 <"currenttime">

例子:

|用户名 | 当前时间|

|10002 | 今天|

定义文件:

@And("^enter the current time as (.*)")
public void currenttime(String arg1) {
    SimpleDateFormat formatter = new SimpleDateFormat("HH:MM");  
    Date date = new Date();
    System.out.println(formatter.format(date)); 
    if (arg1 == "today") {
        driver.findElement(By.id("period")).sendKeys(formatter.format(date));
    }
}

在黄瓜范围报告中:它只显示“今天”而不是动态值(当前时间=“07:18”)

请指导我..

标签: seleniumcucumberextent

解决方案


推荐阅读