我的日历上个月和日期选择的原因是什么
我正在尝试5月24日,但这是4月24日。当我从5月1日至5月23日选择时,这是正确的选择。我有下拉日历
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;
}
}
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您在5月24日发布了这个问题,因此我怀疑这可能与此日期尚未选择的事实有关(由于某些原因,它是灰色的)。
因此:
您仅检查日期,而不是一个月,因此需要第一个可用的24个。
我的建议是首先检查是否可以手动选择24号,如果可以选择它,那么您正在运行的Selenium脚本使用不同的时区?
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:
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?