我的日历上个月和日期选择的原因是什么

发布于 2025-01-31 16:25:42 字数 324 浏览 3 评论 0原文

我正在尝试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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离旧人 2025-02-07 16:25:42

由于您在5月24日发布了这个问题,因此我怀疑这可能与此日期尚未选择的事实有关(由于某些原因,它是灰色的)。

因此:

(date.Equals("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:

(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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文