简体   繁体   English

如何从日期选择器离子硒网驱动器中选择日期?

[英]How to select date from date picker ion selenium web driver?

What is the code for selecting the date from date picker in selenium web driver ? 在Selenium Web驱动程序中从日期选择器中选择日期的代码是什么? We tried a lot on java selenium web driver codings 我们在Java Selenium Web驱动程序编码上尝试了很多

![Selenium Codings for Web driver] [ http://i.stack.imgur.com/15gdR.png] ![用于Web驱动程序的硒编码] [ http://i.stack.imgur.com/15gdR.png]

Find the below attached screen shots 查找以下附件的屏幕截图

Try this 尝试这个

Click on the Joining Date field and click on required date like 单击加入日期字段,然后单击所需的日期,例如

driver.findElement(By.<Joining Date field>).click();
driver.findElement(By.linkText(<Date>)).click();

Ex: 例如:

driver.findElement(By.id("calendarSelect")).click();
driver.findElement(By.linkText("6")).click();

使用Absolute xpath,只需使用firebug标识该日期选择器的日期,然后右键单击以获取xpath,然后使用该xpath选择该元素

Try this, its never fails 试试这个,它永远不会失败

`try{ `尝试{

    WebElement dateWidget = driver.findElement(By.xpath(OR.getProperty(object)));

    List<WebElement> rows = dateWidget.findElements(By.tagName("tr"));  
    List<WebElement> columns = dateWidget.findElements(By.tagName("td"));  

    for (WebElement cell: columns){
        if (cell.getText().equals(data)){
            cell.findElement(By.linkText(data)).click();
            break; 
        }
    }
}catch(Exception e){
    return Constants.KEYWORD_FAIL+" -- Not able to select the date"+e.getMessage();
}`

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

相关问题 Selenium Web驱动程序日期选择器在发送键后是否存在于页面中? - Selenium web driver Date picker exists in page after the send keys? 如何在 Selenium WebDriver 中选择日期选择器 - How to select the Date Picker In Selenium WebDriver Selenium Java:无法从日期选择器中选择日期 - Selenium Java: Unable to Select Date from Date Picker 如何从硒的日期选择器中选择今天的日期和时间(+15 分钟) - How to select today date & time(+15mins) from a date picker in selenium 如何使用Selenium和Java从Bootstrap Glyphicon日期选择器中选择日期 - How to select the date from Bootstrap Glyphicon date picker using Selenium and Java 日期计算器:Selenium Web Driver - Date calculator : Selenium Web Driver 什么是Bootstrap压延机以及如何从Bootstrap日历中选择日期,该日期仅在使用Java的Selenium Web驱动程序中是只读的 - What is bootstrap calender and how to select a date from bootstrap calendar which is read only in selenium web driver using java 如何从 Selenium 中的日期下拉列表中获取日期 Select - How to Select a Date from Date dropdown in Selenium 如何在硒Web驱动程序中提取或选择剩余元素上的特定日期和时间 - How to extract or select Particular Date and Time on remainder Element in selenium web driver 无法从日期选择器中选择日期 - not able to select date from date picker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM