[英]how to select values from date-picker in Cucumber-java
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. 我正在尝试在Expedia网站上预订航班的方案。但是无法从日期选择器视图中选择出发日期。我能够使用提交键输入日期。但是我希望通过单击自动选择日期。 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");
}
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();
只需在末尾添加.click(),如下所示:
driver.findElement(By.xpath(".//*[@id='flight-departing']")).sendKeys("26/07/2015").click();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.