Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

login to website as user, no browser

 
chop ficaro
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there's probably no way to do this, but i was wondering if java could login as a user to a website without opening a browser
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe, it depends on how the site is built. Either way, you'll need cookies to let the server know you remembered the login. I'd check out Apache's HttpClient or a similar browser emulation library. I believe JWebUnit can also do what you need.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, JWebUnit (and HtmlUnit, on which it's built) can do this, and they have a much higher level API than HttpClient, so there's much less code to write.
 
chop ficaro
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys il check it out
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic