Skip to content

Instantly share code, notes, and snippets.

@seleniumgists
Created June 14, 2019 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seleniumgists/022f5d21b76b31cd0c3b6b585c90582e to your computer and use it in GitHub Desktop.
Save seleniumgists/022f5d21b76b31cd0c3b6b585c90582e to your computer and use it in GitHub Desktop.
generated automatically from #selenium on seleniumhq slack
@Test
public void datePickerBootstrap() {
driver = new ChromeDriver();
wait = new WebDriverWait(driver, 5);
driver.manage().window().maximize();
driver.get("<https://uxsolutions.github.io/bootstrap-datepicker/?markup=input&format=&weekStart=&startDate=&endDate=&startView=0&minViewMode=0&maxViewMode=4&todayBtn=false&clearBtn=false&language=en&orientation=auto&multidate=&multidateSeparator=&keyboardNavigation=on&forceParse=on#sandbox>");
driver.findElement(By.cssSelector("#sandbox-container .form-control")).click();
WebElement datePicker = wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".datepicker")));
List<WebElement> dates = datePicker.findElements(By.cssSelector("td.day:not(.old)"));
for (WebElement date : dates) {
if(date.getText().contentEquals("25")) {
date.click();
System.out.println("clicked date");
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment