What is the code for selecting the date from date picker in selenium web driver ? We tried a lot on java selenium web driver codings
![Selenium Codings for Web driver] [ 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();
}`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.