Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Selenium Input Data
- selenium.type("id=username","myName");
- selenium.type("id=password","myPassword");
- selenium.click("id=login");
- public class EUAUser {
- private String username;
- private String password;
- private boolean isUsed
- public EUAUser(String uname, String pwd){
- this.username = uname;
- this.password = pwd;
- isUsed = false;
- }
- public String getPassword(){
- return password;
- }
- public String getUsername(){
- return username;
- }
- public void lockUser(){
- isUsed = true;
- }
- }
- public class UserPool {
- private List<EUAUser> userList = new ArrayList<EUAUser>();
- public UserPool(){
- userList.add(new EUAUser("firstUser","a"));
- userList.add(new EUAUser("MyUsername", "a"));
- userList.add(new EUAUser("TestUser", "a"));
- userList.add(new EUAUser("TSTUser2", "a"));
- }
- public EUAUser getNextUser() throws RuntimeException {
- for(EUAUser user: userList){
- if (!user.isUsed()){
- user.lockUser();
- return user;
- }
- }
- throw new RuntimeException("No free user found.");
- }
- UserPool pool = new UserPool();
- EUAUser user = pool.getNextUser();
- selenium.type("id=username", user.getUserName());
- selenium.type("id=password", user.getPassword());
- selenium.click("id=login");
Add Comment
Please, Sign In to add comment