Appium - 在一个月的特定日期之后选择两天

Appium - Pick Two days after a specific day of month

我正在尝试选择当前日期之后的两天。在我的 StepImplementation class 中,我写了一个这样的函数,但它给了我一个错误:

@Step("pick two days after current day")
    public void getCurrentDayOfMonth(String day) throws InterruptedException {
        Calendar cal = Calendar.getInstance();
        int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);

        int dayToPick = dayOfMonth + 2;
        day = String.valueOf(dayToPick);

        appiumDriver.findElement(By.xpath("//*[@text='" + day + "']")).click();
        System.out.println("Element is clicked.");
        Thread.sleep(2000);
    }

对于我的 String day 参数,它向我显示此错误:参数计数不匹配(发现 1 预期为 0),步骤注释:'pick two days after current day'

基本上,我正在尝试从日期选择器中选择航班日期。我必须在当前日期之后选择两天,但我有点困惑。

感谢您的帮助。

我写了另一个方法,现在效果很好:

@Step("read text value of the element with <id>")
    public void readTextValue(String id) throws InterruptedException {
        String currentDate = appiumDriver.findElement(By.id(id)).getText();
        System.out.println("Element has been read.");
        int dayToPick = Integer.parseInt(currentDate) + 2;
        String dayToPickAsText = String.valueOf(dayToPick);
        appiumDriver.findElement(By.xpath("//*[@text='" + dayToPickAsText + "']")).click();
        Thread.sleep(2000);
    }