简体   繁体   English

Xpath 从日期选择器中定位一天的元素

[英]Xpath to locate the element of a day from the date picker

I have to click on day 11 on the calendar but I am unable to construct XPath to perform click operation on that particular date.我必须在日历上的第 11 天单击,但我无法构造 XPath 以在该特定日期执行单击操作。

I am unable to copy-paste the HTML code here so kindly find the attached image for the HTML and please suggest suitable XPath.我无法在此处复制粘贴 HTML 代码,因此请找到 HTML 的附件图像,并请建议合适的 XPath。 在此处输入图像描述

Try this:尝试这个:

CODE代码

day_that_you_want = "10"    
//td[contains(text(), day_that_you_want)]

If you need to click on the active day, which is 11 in this case, you can fetch it using its class in the xpath.如果您需要点击活跃日,在本例中为 11,您可以使用 xpath 中的 class 获取它。
Your should be:你应该是:

//td[@class='active day'] 

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

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