简体   繁体   English

从日期选择器中选择日期

[英]Selecting date from datepicker

I'm new to selenium, can anyone suggest how to click required date from the date picker. 我是硒的新手,任何人都可以建议如何从日期选择器中单击所需的日期。 Here is the scenarios in attached screen shot 这是所附屏幕截图中的场景 在此处输入图片说明

use this piece of code and let me know if there is any issue 使用这段代码,让我知道是否有任何问题

List<WebElement> alldates = driver.findElements(by.id('locator of the date picker which conatins all dates in it'));
    for (WebElement dates : alldates) {
                    if (dates.isDisplayed() && dates.isEnabled()
                            && dates.getText().equalsIgnoreCase("Date To be Clicked")) {
                        dates.click();
                    }
                }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM