Search code examples
rubyformspostwebsimulate

Simulating a web navigation with Ruby


I'm trying to simulate an user filling a form and submiting it with ruby. I heard it was possible with some test framework when you test your own application (eg : testing a rails app).

What I want to do is : - open a webpage where there's a form. - fill the form - submit the form

Is there any magic gem to do so, or do I need to parse the page and use a post request with arguments ?

Thanks !


Solution

  • I suggest you Webrat or Capybara. Capybara uses embedded webkit engine written in Qt, so you don't need any browser to test your application.

    https://github.com/brynary/webrat

    https://github.com/jnicklas/capybara