Im trying to open the calendar and click the month. I can manage to open up the calendar but my xpath for the calendar isnt being recognized. I validated that my xpath works in the chrome console but its only able to validate it once the calendar is opened. Can someone please help me out? Thanks!
`import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class CalendarExample {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","C:\\Program Files\\Java\\Selenium\\Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.path2usa.com/travel-companions");
List<WebElement> dates = driver.findElements(By.className("day"));
String text = "";
//select August 22 from calendar
//step 1: open the calendar
driver.findElement(By.xpath("//input[@id='travel_date']")).click();
//step 2: click the month
driver.findElement(By.xpath("//body/div[4]/div[@class='datepicker-days']/table//th[@class='datepicker-switch']")).click();
}
}