dimanche 16 avril 2017

Selenium Testing - Unable to select a value from the calendar list

I am not able to select the date value from the calendar list. All the other tests are working.

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;

public class ch1 {

        public static void main(String[] args) throws InterruptedException {
                // TODO Auto-generated method stub
     System.setProperty("webdriver.chrome.driver", "C://testing/chromedriver_win32/chromedriver.exe");
     WebDriver driver = new ChromeDriver();
     driver.manage().timeouts().implicitlyWait(5000, TimeUnit.MILLISECONDS);
     driver.get("https://www.via.com");
     try
     {
         driver.findElement(By.xpath("//div[@class='wzrk-button-container']/button[1]")).click();
     }
     finally
     {
     driver.findElement(By.xpath("//div[@class='element relElements airportElements']/input[1]")).sendKeys("BLR");
     driver.findElement(By.xpath("//div[@class='calendar-icon']")).click();
     Select s = new Select(driver.findElement(By.xpath("//*[@id='depart-cal']/div[3]")));
     s.selectByValue("19");
    
     driver.wait(5000);
     }
        }

}

The text is getting inputted and the calendar is opening, but the date is not getting selected.

Aucun commentaire:

Enregistrer un commentaire