如何在不带cssselector的情况下使用chromedriver和xpath在spicejet网站中选择“ FROM”和“ TO”下拉菜单?

时间:2019-05-14 09:39:02

标签: selenium-chromedriver

我想了解与spicejet from相关的代码,从到下拉选项,并使用xpath并选择选项

日食

driver.findElement(By.xpath("//*[@id=\"OneWay\"]/label")).click(); Thread.sleep(2000); driver.findElement(By.id("ControlGroupSearchView_AvailabilitySearchInputSearchVieworiginStation1")).click(); 
Thread.sleep(2000); 
driver.findElement(By.id("//*@id=\"ctl00_mainContent_ddl_originStation1_CTXT\"]")).sendKeys("Hyderabad (HYD)");
driver.findElement(By.linkText("Hyderabad (HYD)")).click();
Thread.sleep(2000);
driver.findElement(By.id("//*@id=\"ctl00_mainContent_ddl_destinationStation1_CTXT\"]")).sendKeys("MAA");
driver.findElement(By.linkText("Chennai (MAA)")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//*@id=\"ctl00_mainContent_view_date1\"]")).sendKeys("01/04"); 
Thread.sleep(2000); 
WebElement passengerDropdown=driver.findElement(By.xpath("//*@id=\"divpaxinfo\"]")); 
Select select2 = new
Select(passengerDropdown); select2.selectByVisibleText("1 Adult");
Thread.sleep(2000);
WebElement currencyDropdown = driver.findElement(By.xpath("//*[@id=\"ctl00_mainContent_DropDownListCurrency\"]"));
Select select3 = new Select(currencyDropdown);
select3.selectByVisibleText("INR"); Thread.sleep(2000);
driver.findElement(By.xpath("//*[@id=\"ctl00_mainContent_btn_FindFlights\"]")).click(); 
Thread.sleep(2000);

预期结果必须从中选择hyderabad,在to中选择chennai。 但是实际结果没有任何选择的迹象

0 个答案:

没有答案