Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. WebClient webClient = new WebClient(BrowserVersion.CHROME);
  2.  
  3. HtmlPage page = webClient.getPage("https://twitter.com/login");
  4.  
  5. HtmlForm form = page.getForms().get(1);
  6.  
  7. form.reset();
  8.  
  9. HtmlTextInput username = form.getInputByName("session[username_or_email]");
  10.  
  11. username.setText("xxxxxxxxxx");
  12.  
  13. HtmlPasswordInput password = form.getInputByName("session[password]");
  14.  
  15. password.setText("xxxxxxxxx");
  16.  
  17. HtmlInput button = form.getInputByValue("Log in");
  18.  
  19. HtmlPage p = button.click();
  20.  
  21. webClient.getOptions().setThrowExceptionOnScriptError(false);
  22.  
  23.  
  24. System.out.println(p.asText());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement