java - 没有从日历中选择日期..我已经解决了这个问题。问题已解决
问题描述
我有一个日历,在选择日期时需要单击添加日期的勾号按钮
格式:8/20/2021, 15:28:13
我试过的:
我尝试创建一个方法,如下所示:
public static void selectdatefromcalender(WebDriver driver,String columnKey, Map<String, String> formEntryMap)
{
String xPath = Xpath.dateXpathReplace.replace("XXXX", columnKey);
= 我在这里得到日期字段的标签名称。这是单击日历按钮的 Xpath。
clickOnElement(driver, xPath); /**/ This will click on the Calender button and works till this**
//But is not selecting the value from the Date
List<WebElement> columns=driver.findElements(By.tagName("td"));
for (WebElement cell: columns){
//Select 13th Date
if (cell.getText().equals(formEntryMap.get(columnKey)))
= 这将从输入为 8/23/2021 的表单中获取值
{
cell.findElement(By.linkText(formEntryMap.get(columnKey))).click();
clickOnButton(driver, AppXPathsConstants.CalenderbuttonXpath);
= 在日历的末尾有一个打勾按钮,单击它将关闭日历并将添加日期为 2021 年 8 月 25 日,16:05:20
日期选择部分不工作,需要输入关于可以做些什么来使它工作,
有人可以就此提供意见吗?可以添加更多信息
我已经解决了这个问题。由于日期字段是一个输入框,我采用了 xpath 并输入了日期.....
解决方案
推荐阅读
- c# - asp.net:如何在我的应用程序中获取另一个页面的 URL?
- php - MySQL选择单元格值等于数字的行,其中非数字字符被删除
- java - 在php中生成带有位置的真值表
- java - new 运算符总是返回相同的引用
- reactjs - 多选大纲变体属性不起作用
- angular - 在组件之间使用带参数的回调函数
- javascript - 如果对象值在javascript中为真,则迭代数组提取并添加到新列表
- python - Tkinter:使用 TopLevel 窗口的存在作为条件
- apache-flink - Apache Flink 依次写入多个接收器
- python - Flask-SQL 中的关联对象在 shell 中表现,但在网站上创建“非 JSONable”错误