How to write selenium web driver code to validate the multiple user accounts(entertainment) using data driven testing? -


in code,for example if user not having access entertainment site display either upgrade or subscribe page(relevant cable provider subscription page).

i don't know how write logic below mentioned scenarios.please me(i beginner java , web driver)

scenario 1:.in excel sheet, first mention accessible account (1st column),in 2nd column(subscription page accounts),in 3rd column(able watch/accessible account) in 4th column(subscription account) ..

scenario 2 : validate , print in excel sheet. please me how write logic.

@test     public void playoncheck() throws arrayindexoutofboundsexception,             biffexception, ioexception, exception {          fileinputstream f = new fileinputstream(                 "d:\\eclipse screenshots\\datadrive.xls");          workbook w = workbook.getworkbook(f);         s = w.getsheet(0);          system.out.println(s.getrows());            (int row = 1; row <= s.getrows() - 1; row++) {              driver.findelement(by.xpath("/html/body/div/div[3]/div/div[2]/div[2]/div[2]/a")).click();             driver.switchto().frame(driver.findelement(by.xpath("//iframe[@id ='videoplayer']")));             webelement = driver.findelement(by.xpath("//body//div[@class = 'player']//a[@class = 'signinbutton med2pxround']"));             we.click();              string username = s.getcell(0, row).getcontents();             system.out.println("username " + username);              driver.findelement(by.name("user")).sendkeys(username);              string password = s.getcell(1, row).getcontents();              system.out.println("password " + password);              driver.findelement(by.name("passwd")).sendkeys(password);             driver.findelement(by.id("sign_in")).click();                 if(driver.getcurrenturl().matches(" subscription page url")){                      if(driver.findelement(by.xpath("//div[@id = 'content']//a[@class = 'button']")).isdisplayed()){                          webelement = driver.findelement(by.xpath("/html/body/div[3]/div/h1"));                         system.out.println("subscribe button displayed   " +  a.gettext());                     }                       continue;                 }               else if(driver.findelement(by.xpath("//div[@class = 'mainvideocontainer']")).isenabled()){                  driver.switchto().frame(driver.findelement(by.xpath("//iframe[@id ='videoplayer']")));                  if(driver.findelement(by.xpath("//body//div[@class = 'player']//*[@id='strobemediaplayback'] ")).isenabled()){                      system.out.println("video player enabled , video starts playing");                  }                 driver.switchto().defaultcontent();                 driver.findelement(by.linktext("sign out")).click();             }               else if (driver.findelement(by.linktext("sign out")).isdisplayed()) {                  system.out.println("user logged in");               }             else{                 system.out.println("oops!!!!! has happened , video not starts playing @ moment");             }          } 

if run above code,i able identify subscription page accounts after executing subscription accounts not able switch able watch accounts.please me.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -