【问题标题】:Selenium is not click to date硒不是点击日期
【发布时间】:2021-10-26 10:54:24
【问题描述】:
chDriver.get("https://www.path2usa.com/travel-companions");    
chDriver.findElement(By.xpath("//input[@id='travel_date']")).click();                                           
        List<WebElement> datesL = chDriver.findElements(By.className("day"));                                          
        int countDays = chDriver.findElements(By.className("day")).size();
        for (int i = 0; i < countDays; i++)
        {
            String dateTxt = chDriver.findElements(By.className("day")).get(i).getText();
            if (dateTxt.equalsIgnoreCase("28"))
            {
                chDriver.findElements(By.className("day")).get(i).click();
                break;
            }
        }

我正在学习 Selenium,此代码块取自 Udemy 课程,但它不适用于我。我不明白为什么。 如果工作正常但不点击。

【问题讨论】:

    标签: java selenium intellij-idea calendar


    【解决方案1】:

    我删除了中断,它可以正常工作。

    if (dateTxt.equalsIgnoreCase("32"))
            {
                chDriver.findElements(By.className("day")).get(i).click();
            }
        }
    

    【讨论】:

      猜你喜欢
      • 2015-10-21
      • 1970-01-01
      • 2019-01-26
      • 2019-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-20
      • 2020-06-02
      相关资源
      最近更新 更多