处理硒中的oyo日历

时间:2019-04-13 09:13:23

标签: selenium-webdriver

在该代码中查看我的代码帮助,仅找到类和css或xpth

在该代码中查看我的代码帮助,仅找到类和css或xpth

public class oyo {

    public static void main(String[] args) throws InterruptedException {
        // TODO Auto-generated method stub
        WebDriver driver = new ChromeDriver();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.get("https://www.oyorooms.com/");

        WebElement search= driver.findElement(By.xpath("//*[@id=\"ember908\"]"));
        search.click();
        search.sendKeys("park");
        Thread.sleep(15000);
        driver.findElement(By.xpath("//*[@id=\"ember898\"]/div/div[1]")).click();

        driver.findElement(By.xpath("//*[@id=\"ember928\"]")).click();
        Thread.sleep(3000);
        //MONTH
        while(!driver.findElement(By.cssSelector("")).getText().contains("December"))
        {
            driver.findElement(By.cssSelector("")).click();

        }

        List<WebElement> dates = driver.findElements(By.className(""));
        //grab common attribute // put into list and iterate
        int count = driver.findElements(By.className("")).size();
        for(int i=0;i<count;i++)
        {
            String text = driver.findElements(By.className("")).get(i).getText();
            if(text.equalsIgnoreCase("23"))
            {
                driver.findElements(By.className("")).get(i).click();
                break;



    }

}

元素不可交互

0 个答案:

没有答案