It is possible to simulate a browser in Ruby? I know about OpenURI, but I want to simulate even the cookies behavior, etc.
Mechanize is the way to go for basic things like simplifying interaction, holding onto cookies, etc.
For full browser simulation, though, including fancy things like Javascript, we're more limited. A tool like Watir, however, can actually open up the browser and run it as your code dictates, which can sometimes be the only option if interacting with complex Javascript applications is a requirement.
If you don't need to execute javascript you could also try: Curb
Curl::Easy.perform(uri) do |curl|
curl.enable_cookies = true
curl.follow_location = true
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With