jeudi 21 juillet 2016

Unable to locate element: {"method":"xpath","selector":".//*[@id='hotel-checkin']"} Java-Selenuim

****can't type the dates of check-in and check-out,cuz it's unable to locate them ! tried with id and xpath ! Here is the code ****

import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class Test {

        public static void main(String[] args) throws InterruptedException {
            WebDriver driver = new FirefoxDriver();
            driver.get("https://www.orbitz.com/");
            driver.findElement(By.xpath(".//*[@id='tab-flight-tab']/span[1]")).click();
            driver.findElement(By.id("flight-origin")).sendKeys("SFO");
            driver.findElement(By.id("flight-destination")).sendKeys("JFK");
            Thread.sleep(2000);

            //the code below dosen't work

            driver.findElement(By.xpath(".//*[@id='hotel-checkin']")).sendKeys("08/16/2016");
            driver.findElement(By.id("hotel-checkout")).sendKeys("08/17/2016");

        }

    }

Aucun commentaire:

Enregistrer un commentaire