Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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 如何在上选择出发日期和返回日期https://www.turismocity.com.br/_Java_Selenium_Dynamic_Automation_Calendar - Fatal编程技术网

Java 如何在上选择出发日期和返回日期https://www.turismocity.com.br/

Java 如何在上选择出发日期和返回日期https://www.turismocity.com.br/,java,selenium,dynamic,automation,calendar,Java,Selenium,Dynamic,Automation,Calendar,我正在尝试选择出发日期和返回日期,但我只得到出发日期。返回的错误为: 元素单击被拦截:元素。。。在点(5565)处不可单击。其他元素将收到单击:… 我正在使用以下代码: public void getDepartureDate() throws InterruptedException { driver.findElement(By.xpath("//div[@class='tc-datepicker hbox e2e-outbound-datepicker']/span[2

我正在尝试选择出发日期和返回日期,但我只得到出发日期。返回的错误为:

元素单击被拦截:元素。。。在点(5565)处不可单击。其他元素将收到单击:…

我正在使用以下代码:

public void getDepartureDate() throws InterruptedException {

    driver.findElement(By.xpath("//div[@class='tc-datepicker hbox e2e-outbound-datepicker']/span[2]")).click();

    List<WebElement> dates = driver.findElements(By.className("td"));

    for (int i = 0; i < dates.size(); i++) {
            
        String text = dates.get(i).getText();
        if (text.equalsIgnoreCase("22")) {
            dates.get(i).click();
            break;
        }
    }
        
    Thread.sleep(3000);

    List<WebElement> datesBack = driver.findElements(By.className("td"));

    for (int j = 0; j < datesBack.size(); j++) {

        String text = datesBack.get(j).getText();
        if (text.equalsIgnoreCase("24")) {
            datesBack.get(j).click();
            break;
        }
    }
}
}
public void getDepartureDate()引发InterruptedException{
findElement(By.xpath(“//div[@class='tc-datepicker hbox e2e outbound datepicker']/span[2]”)。单击();
列表日期=driver.findElements(By.className(“td”);
对于(int i=0;i

Obs:我不需要点击返回日期来选择它。当您选择离开日期时,此日历将自动更改为返回日期。