Guest User

Untitled

a guest
Jul 26th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Selenium Input Data
  2. selenium.type("id=username","myName");
  3. selenium.type("id=password","myPassword");
  4. selenium.click("id=login");
  5.  
  6. public class EUAUser {
  7.  
  8. private String username;
  9. private String password;
  10. private boolean isUsed
  11.  
  12. public EUAUser(String uname, String pwd){
  13. this.username = uname;
  14. this.password = pwd;
  15. isUsed = false;
  16. }
  17.  
  18. public String getPassword(){
  19. return password;
  20. }
  21.  
  22. public String getUsername(){
  23. return username;
  24. }
  25.  
  26. public void lockUser(){
  27. isUsed = true;
  28. }
  29. }
  30.  
  31. public class UserPool {
  32. private List<EUAUser> userList = new ArrayList<EUAUser>();
  33.  
  34. public UserPool(){
  35.  
  36. userList.add(new EUAUser("firstUser","a"));
  37. userList.add(new EUAUser("MyUsername", "a"));
  38. userList.add(new EUAUser("TestUser", "a"));
  39. userList.add(new EUAUser("TSTUser2", "a"));
  40.  
  41. }
  42.  
  43. public EUAUser getNextUser() throws RuntimeException {
  44. for(EUAUser user: userList){
  45. if (!user.isUsed()){
  46. user.lockUser();
  47. return user;
  48. }
  49. }
  50. throw new RuntimeException("No free user found.");
  51. }
  52.  
  53. UserPool pool = new UserPool();
  54. EUAUser user = pool.getNextUser();
  55. selenium.type("id=username", user.getUserName());
  56. selenium.type("id=password", user.getPassword());
  57. selenium.click("id=login");
Add Comment
Please, Sign In to add comment