Search

Login to twitter

// login to twitter
public void loginToTwitter(String username, String password) throws IOException {

        String url = "http://twitter.com/" + username + "/followers";
        HtmlPage loginPage = webClient.getPage(url);
        HtmlElement nameInput = loginPage.getElementById("username_or_email");
        HtmlElement passwordInput = loginPage.getElementById("password");
        HtmlElement signInButton = loginPage.getElementById("signin_submit");
        nameInput.setAttribute("value", username);
        passwordInput.setAttribute("value", password);
        HtmlPage followersPage = signInButton.click();
        System.out.println("login successful");

    }