Currently working on Selenium WebDriver and using Java. I want to select values in date range
from the drop down.. I want to k
public String datePicker(String object,String data){
APP_LOGS.debug("selecting date");
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();
}
return Constants.KEYWORD_PASS;
}
try to SendKeys instead of picking the date
driver.FindElement(yourBy).SendKeys(yourDateTime.ToString("ffffd, dd.MM.yyyy",CultureInfo.CreateSpecificCulture("en-US")));
If it does not work, try to send native 'tab'
element.SendKeys(OpenQA.Selenium.Keys.Tab);