Skip to content

Instantly share code, notes, and snippets.

@vanduc1102
Created May 23, 2016 07:59
Show Gist options
  • Save vanduc1102/f8692d548861fe14019e979024926ecb to your computer and use it in GitHub Desktop.
Save vanduc1102/f8692d548861fe14019e979024926ecb to your computer and use it in GitHub Desktop.
@Test
public void calendarSelectionTest() throws InterruptedException {
WebDriverWait wait = new WebDriverWait(driver, 10);
// Open first selectBox
WebElement checkBoxElement = driver.findElement(By.id("list_plans_1SelectBoxItContainer"));
checkBoxElement.click();
// select 3 people
WebElement itemElement3 = driver
.findElement(By.xpath(".//*[@id='list_plans_1SelectBoxItOptions']/li[4]/a/span[2]"));
itemElement3.click();
WebElement nextButton = driver.findElement(By.xpath(".//*[@id='formAddPlan']/div[1]/div/ul/li[1]/div[3]/div[2]/div[1]/a"));
nextButton.click();
// Select second shop
By selectedShopByCss = By.cssSelector("#choose-shop li.shop-6 label");
wait.until(ExpectedConditions.elementToBeClickable(selectedShopByCss));
WebElement secondShop = driver.findElement(selectedShopByCss);
secondShop.click();
//Select a date.
WebElement dateElement = wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//*[@id='choose-date']/div[2]/div/table/tbody/tr[2]/td[4]/div/div")));
dateElement.click();
System.out.println("Clicked element "+dateElement.getText());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment