Tuesday, 22 September 2015

REAL TIME TESTNG FRAME WORK FOR REDBUS USING SELENIUM


Redbus with property file


WebDriver wd;
         
          @BeforeClass
          public void invoke()
          {
                    wd= new FirefoxDriver();
                  
          }
         
         
          @AfterClass
          public void close()
          {
                   wd.close();
          }
         
          @BeforeMethod
          public void login() throws InterruptedException, IOException
          {
                   Properties p=new Properties();
                   FileInputStream fis=new FileInputStream("C:\\Documents and Settings\\akki\\workspaceaaaa\\frame\\src\\akki");
                   p.load(fis);

                   wd.get("http:redbus.in");
                   wd.findElement(By.xpath(".//*[@id='signInLink']")).click();

            wd.findElement(By.id(p.getProperty("a"))).sendKeys("yaminireddy24041982@gmail.com");
                   wd.findElement(By.id(p.getProperty("b"))).sendKeys("yamini");
                   wd.findElement(By.id(p.getProperty("c"))).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='ctl00_hotelDiv']")).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();
                            
                   }
                  
}

SELENIUM TESTNG & SELENIUM WEBDRIVER TESTNG FRAME WORK WITH NORMAL,WEB APPLICATION EXAMPLE


No comments:

Post a Comment