Archive for the 'mechanize' Category

19
Apr
10

mechanize logging


If you want to see what your mech is doing at all times, add this in your code:


require "logger"

mech = WWW::Mechanize.new ...
mech.log = Logger.new(STDOUT)

And this will print to STDOUT everything the mech is doing. Solution offered by Evgeny Shadchnev here.

21
Jan
10

trac login with mechanize


If you ever need to login to trac using Ruby, and don’t know how to input your username and password, it’s simple: use the basic_auth method like :


mech.basic_auth(user,password)
mech.get(link_to_trac)




Blog Stats

  • 219,948 hits