Not able to select origin and destination in airline website

13 views
Skip to first unread message

piyush jain

unread,
Apr 18, 2018, 7:19:00 AM4/18/18
to Selenium Users
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class testMakemyTripSlider {

public static void main(String[] args) throws InterruptedException {

System.setProperty("webdriver.chrome.driver","C:\\PIYUSH\\Selenium\\Way2Automation\\Software\\Chrome Driver_win32\\chromedriver.exe");
WebDriver driver=new ChromeDriver();

Thread.sleep(3000);
driver.findElement(By.xpath(".//*[@id='hp-widget__sTo']")).click();
driver.findElement(By.xpath(".//li[@class='ui-autocomplete-category'][@aria-label='Top Cities : Goa, India ']")).click(); 


Issue is on destination or origin as soon as I write By.xpath(".//*[@id='hp-widget__sTo']")).click();  drop down opens but now I cannot select any city from dropdown list 
using code By.xpath(".//li[@class='ui-autocomplete-category'][@aria-label='Top Cities : Goa, India ']")).click(); 


q1) New to selenium so kindly provide the detail code if possible that helps to explain how to select city in drop down list
q2) Need to select any date similarly and click on select to proceed to next screen   ---> 
                      not require large code present in youtube . scenario is just to select one date from drop down for date field and proceed next 


Regards
Piyush


 

Reply all
Reply to author
Forward
0 new messages