Search code examples
rubybrowserbotsposting

Simple bot in ruby


I have written some simple bot in ruby (watir)

require 'rubygems'
require 'watir-webdriver' 

Watir::Browser.default = "firefox"
browser = Watir::Browser.start "http://example.com/"
browser.link(:text, "microblog").click
browser.area(:name, "body").set("test post")
browser.button(:value,"Send").click

how can I achieve something like this, but without browser window (full in console)? can you link me some tutorials or something?


Solution

  • As long as your pages are not heavily dependent on JavaScript, Mechanize may be sufficient.

    You can find some examples here:

    http://docs.seattlerb.org/mechanize/GUIDE_rdoc.html http://docs.seattlerb.org/mechanize/EXAMPLES_rdoc.html