ASSIGNMENT-unable to select Flight and roundtrip button | Selenium Forum
M
Posted on 07/05/2016
import java.util.concurrent.TimeUnit;
Could you please check ---xpath is showing one matching node--I used actions and wait.until but unable to select flights and you told to use to wait.until(ExpectedConditions.InvisibilityofLocator...) where to use that exactly.
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class makemytrip {

public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("http://www.makemytrip.com/");

//WebDriverWait wait=new WebDriverWait(driver, 15);
//wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//a[@class='active first']")));
//wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@class='active first']")));

/*Actions act=new Actions(driver);
WebElement flights= driver.findElement(By.xpath("//a[@class='active first']"));
act.moveToElement(flights).click();*/
//driver.findElement(By.xpath("//div[@id='roundTripTab']/a")).click();
//driver.findElement(By.xpath("//a[@class='active first']")).click();

driver.findElement(By.xpath("//input[@id='from_typeahead1']")).sendKeys("Hyderabad, India (HYD))");
driver.findElement(By.xpath("//input[@id='to_typeahead1']")).sendKeys("New Delhi, India (DEL)");
driver.findElement(By.xpath("//a[@id='start_date_sec']")).click();
driver.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[2]/table/tbody/tr[4]/td[5]/a")).click();
driver.findElement(By.xpath("//a[@id='return_date_sec']")).click();
driver.findElement(By.xpath("//*[@id='ui-datepicker-div']/div[3]/table/tbody/tr[5]/td[4]/a")).click();

driver.findElement(By.xpath("//a[@id='flights_submit']")).click();
//wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//p[@class='text-center intrsl_txt_one append_bottom18 ng-binding']")));
//driver.findElement(By.xpath("//p[@class='text-center intrsl_txt_one append_bottom18 ng-binding']"));
}

}

M
Replied on 09/05/2016

what is the problem?