简体   繁体   中英

what is the reason that my calendar is picking previous month and date

I'm trying to pick May 24th but this is picking April 24th. When i pick from May 1st to May 23rd, this is picking correct. I have dropDown Calendar

List<IWebElement> dateOfList = new List<IWebElement>(driver.FindElement(By.Xpath("my locater"){
foreach(IWebElement td in dateOfList){
string date = td.Text;
if(date.Equals("24"){
td.click;
break;
}
}

Since you posted this question on May 24th, I suspect it may have something to do with the fact that this date is not available for picking yet (it is grayed out for some reason).

With this:

(date.Equals("24")

You check only for the date, not the month, so it takes the first 24th that is available.

My recommendation would be to first check if 24th can be selected manually, if it can be selected, then maybe Selenium script you're running uses different timezone?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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