Reputation: 21
I am trying a scenario to book a flight on Expedia website.but unable to select a departure date from the date picker view.i am able to enter the date by using submit keys.but i want it to auto selected by a click. kindly help me out of this.following is my code
@When("^I click on Departing date$")
public void I_click_on_Departing_date() throws Throwable {
driver.findElement(By.xpath(".//*[@id='flight-departing']")).sendKeys("26/07/2015");
}
Upvotes: 0
Views: 2239
Reputation: 21
I got a solution for my own question and it worked.. By Adding below Code:
driver.findElement(By.xpath(".//*[@id='flight-departing']")).click();
Thread.sleep(2000);
driver.findElement(By.xpath(".//*[@id='home-page']/div[16]/div/div/section[1]/ul/li[4]/a")).click();
Upvotes: 1
Reputation: 1
Just add .click() at the end like this:
driver.findElement(By.xpath(".//*[@id='flight-departing']")).sendKeys("26/07/2015").click();
Upvotes: 0