Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WebClient webClient = new WebClient(BrowserVersion.CHROME);
- HtmlPage page = webClient.getPage("https://twitter.com/login");
- HtmlForm form = page.getForms().get(1);
- form.reset();
- HtmlTextInput username = form.getInputByName("session[username_or_email]");
- username.setText("xxxxxxxxxx");
- HtmlPasswordInput password = form.getInputByName("session[password]");
- password.setText("xxxxxxxxx");
- HtmlInput button = form.getInputByValue("Log in");
- HtmlPage p = button.click();
- webClient.getOptions().setThrowExceptionOnScriptError(false);
- System.out.println(p.asText());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement