答案 0 :(得分:0)
尝试使用CSS定位器使用aria-label
属性标识特定日期:
By.cssSelector("td[aria-label='Jan 1, 2018']") // (or any date that you want to identify)
如果您想要特定日期的div
元素:
By.cssSelector("td[aria-label='Jan 1, 2018']>div") // (or any date that you want to identify)
您可以参数化日期值以使其更通用:
public void selectDate(String date)
By.cssSelector("td[aria-label='" + date + "']") // using string concatenation. you can do Stirng.format method for better readability.