RedBus automation........

1,735 views
Skip to first unread message

Karthikeyan Ar

unread,
Jul 23, 2013, 2:35:02 AM7/23/13
to seleniu...@googlegroups.com
Hi all of u

Can any body tell how will automate for this site date area........In this code date of Joureny is not finding... any body tell this...............


    WebDriver driver = new FirefoxDriver();
        driver.get("http://www.redbus.in");
        WebElement rFrom= driver.findElement(By.id("DDLSource"));
        rFrom.sendKeys("Bangalore");
        rFrom.sendKeys(Keys.TAB);
        WebElement rTo= driver.findElement(By.id("DDLDestination"));
        rTo.sendKeys("Chennai");
        rTo.sendKeys(Keys.TAB);
//        WebDriverWait wait = new WebDriverWait(driver,10);
//        wait.until(ExpectedConditions.elementToBeClickable(By.linkText("25")));
        WebElement fDate= driver.findElement(By.id("calendar"));
        List <WebElement> lftDate= fDate.findElements(By.tagName("table"));
        for(WebElement fdTable:lftDate)
        {
        fdTable.findElement(By.linkText("25")).click();
        break;
        }

Anandh J

unread,
Jul 29, 2015, 9:17:28 PM7/29/15
to Selenium Users, karthik...@gmail.com

Try this code...
package redbus;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;

public class google_redbus {

public static void main(String[] args) {
//WebDriver driver = new FirefoxDriver();
// private static final String wait = null;
//public static WebDriver driver;
System.setProperty("webdriver.ie.driver", "C:\\Users\\Anand\\Documents\\selenium\\IEDriverServer.exe");
WebDriver driver=new InternetExplorerDriver();
driver.get("http://www.redbus.in");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElement(
By.xpath(".//*[@id='txtSource']"))
.sendKeys("Bangalore");
driver.findElement(
By.xpath(".//*[@id='txtDestination']"))
.sendKeys("Chennai");
driver.findElement(
By.xpath(".//*[@id='txtOnwardCalendar']"))
.click();
driver.findElement(
By.xpath(".//*[@id='rbcal_txtOnwardCalendar']/table[1]/tbody/tr[7]/td[5]"))
.click();
driver.findElement(
By.xpath(".//*[@id='txtReturnCalendar']"))
.click();
driver.findElement(
By.xpath(".//*[@id='rbcal_txtReturnCalendar']/table[2]/tbody/tr[4]/td[2]"))
.click();
driver.findElement(
By.xpath(".//*[@id='searchBtn']"))
.click();
driver.findElement(
By.xpath(".//*[@id='onwardSortAndFilter']/div[2]/div/div[8]/a"))
.click();
driver.findElement(
By.xpath(".//*[@id='onwardTrip']/div[2]/ul/li[1]/div/div[8]/button"))
.click();
}}
Reply all
Reply to author
Forward
0 new messages