import
org.openqa.selenium.By;
import
org.openqa.selenium.WebDriver;
import
org.openqa.selenium.firefox.FirefoxDriver;
import
org.testng.annotations.AfterClass;
import
org.testng.annotations.AfterMethod;
import
org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Test;
public class
testngggggggapln {
static WebDriver wd;
    @BeforeClass
    public void invoke()
    {
       wd = new
FirefoxDriver();
    }
    @AfterClass
    public void close()
    {
       wd.close();
    }
    @BeforeMethod
    public void login() throws
InterruptedException
    {
       wd.get("http:redbus.in");
     wd.findElement(By.xpath(".//*[@id='signInLink']")).click();
     wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("yaminireddy24041982@gmail.com");
     wd.findElement(By.xpath(".//*[@id='password']")).sendKeys("yamini");
     wd.findElement(By.xpath(".//*[@id='signInBtn']")).click();
       Thread.sleep(5000l);
    }
       @AfterMethod
       public void logout()
       {
        wd.findElement(By.xpath(".//*[@id='signOutLink']")).click();
       }   
    @Test 
    public void buses()
    {
     wd.findElement(By.xpath(".//*[@id='wrapper1']/header/div[2]/div/div[1]/a[1]")).click();
     wd.findElement(By.xpath(".//*[@id='txtSource']")).sendKeys("hyderabad");
     wd.findElement(By.xpath(".//*[@id='txtDestination']")).sendKeys("kadapa");
     wd.findElement(By.xpath(".//*[@id='txtOnwardCalendar']")).click();
     wd.findElement(By.xpath(".//*[@id='rbcal_txtOnwardCalendar']/table[1]/tbody/tr[6]/td[6]")).click();
     wd.findElement(By.xpath(".//*[@id='txtReturnCalendar']")).click();
     wd.findElement(By.xpath(".//*[@id='rbcal_txtReturnCalendar']/table[2]/tbody/tr[7]/td[4]")).click();
     wd.findElement(By.xpath(".//*[@id='searchBtn']")).click();
    }
       @Test
       public void hotels()
       {
        wd.findElement(By.xpath(".//*[@id='wrapper1']/header/div[2]/div/div[1]/a[2]/span")).click();
        wd.findElement(By.xpath(".//*[@id='txtSource']")).sendKeys("mumbai");
        wd.findElement(By.xpath(".//*[@id='txtOnwardCalendar']")).click();
        wd.findElement(By.xpath(".//*[@id='rbcal_txtOnwardCalendar']/table[1]/tbody/tr[6]/td[6]")).click();
        wd.findElement(By.xpath(".//*[@id='txtReturnCalendar']")).click();
        wd.findElement(By.xpath(".//*[@id='rbcal_txtReturnCalendar']/table[1]/tbody/tr[7]/td[2]")).click();
        wd.findElement(By.xpath(".//*[@id='searchBtn']")).click();
       }
}
No comments:
Post a Comment