Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. class Navigator()
  2. {
  3. String username;
  4. String password;
  5.  
  6. //constructor
  7.  
  8. navigator(String uname, String pwd)
  9. {
  10. username=uname;
  11. password=pwd;
  12.  
  13. @test
  14. login
  15. {
  16. System.out.println("Inside login");
  17. System.out.println(username);
  18. System.out.println(password);
  19. driver.findElement(username).sendKeys(username);
  20. driver.findElement(username).sendKeys(username);
  21. driver.findElement(login).click();
  22. }
  23.  
  24. @test(dependsonMethods="login", invocationCount=10)
  25. navigation()
  26. {
  27. //navigate to a particular webpage and perform actions there
  28. }
  29.  
  30. @test(dependsonMethods="navigation")
  31. logout()
  32. {
  33. //logout of the page
  34. }
  35.  
  36. class GetUser extends Navigator
  37. {
  38. String username, password;
  39.  
  40. //constructor
  41.  
  42. @factory(dataprovider="userdetail")
  43.  
  44. GetUser(String uname, String passwd)
  45. {
  46. super(uname,pwd);
  47. }
  48.  
  49.  
  50. @DataProvider
  51. object [][] userdetail()
  52. {
  53. //code to find number of users specified in an excel sheet something like below where
  54. detail[0][0]=username from excel sheet
  55. detail[0][1]=password from excel sheet
  56. .
  57. .
  58. .
  59. .
  60. then return detail[no.of users][2];
  61.  
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement