Naveen Naveen - 9 months ago 65
Java Question

Select calendar button using selenium webdriver

I'm trying to select a calendar button. Here is my code:

By.className("ui-datepicker-trigger ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only")

Primefaces Calendar with Button

Html code


Actually Selenium does not support compound class to locate an element using By.className(), you should try using By.cssSelector() instead as below :-

driver.findElement(By.cssSelector("button.ui-datepicker-trigger.ui-button[aria-label='Show Calendar']")).click();