Selenium Webdriver Scripts : Working with Calendar using Selenium webdriver

Selenium webdriver script to select current month date and next month date through calendar.

package selenium_examples;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Sample {

public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://hotels.spicejet.com/index.html");

driver.findElement(By.xpath("//html/body/div[3]/div/table/tbody/tr/td[1]/div[1]/form[1]/fieldset/div[2]/div[2]/div[1]/a/img")).click();
driver.findElement(By.linkText("8")).click();
driver.findElement(By.xpath("//html/body/div[3]/div/table/tbody/tr/td[1]/div[1]/form[1]/fieldset/div[2]/div[2]/div[2]/a/img")).click();
driver.findElement(By.xpath("//html/body/div[5]/div[2]/a[2]/span")).click();
driver.findElement(By.linkText("12")).click();

}

  }


Above scripts selects ‘Check in date’  as 8th of the current month i.e. 8/11/2013   and ‘Check out date’ as 12th of the next month i.e. 12/12/2013 from calendar.

Working with calendar - selenium webdriver

 



 

No comments:

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge