Questions tagged [mechanize-ruby]

The Ruby library for automating interaction with websites.

The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follows redirects, can follow links, and submit forms. Form fields can be populated and submitted. Mechanize also keeps track of the sites that you have visited as a history.

193 questions
1
vote
1 answer

scraping image with mechanize ( ruby )

I'm trying to save image from web_page with mechanize. I use this code: @current_agent.get( image_url ).save ( save_path ) Error (I think I have a problems with timeout settings): I, [2013-03-25T14:42:13.924694 #31865] INFO -- :…
bmalets
  • 3,207
  • 7
  • 35
  • 64
1
vote
1 answer

cannot load such file -- mechanize.rb (LoadError) on OSX 10.6

I have a simple script: require 'rubygems' require 'mechanize' p 'Success!' When I run the script, I get: /Users/.../.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file --…
DMCoding
  • 1,167
  • 2
  • 15
  • 30
1
vote
2 answers

Using ruby to retrieve a document from a website

I have written a script in ruby that navigates through a website and gets to a form page. Once the form page is filled out the script hits the submit button and then a dialogbox opens asking you where to save it too. I am having trouble trying to…
thedarkknight228
  • 535
  • 1
  • 5
  • 9
1
vote
1 answer

Is there anyway to search and get the value of .. ?

In a webpage suppose i have the below values: test11 test12 test21…
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
1
vote
1 answer

xpath to get text inside the form

I have an HTML structure of a page like this,


Category: Food &…
Mansoor Elahi
  • 941
  • 1
  • 9
  • 19
1
vote
1 answer

Sharing (Mechanize) sessions across different requests in multi-threaded environment?

I'm developing an application that uses Ruby's Mechanize to login to a password-protected site and consumes certain data feeds. My application, in turn, allows my users to query and operate on the data. Every time a new users visits my app, it logs…
Alex R
  • 13
  • 2
1
vote
0 answers

How can I click on all links of website with mechanize in ruby?

I have a small problem. I want to click on some links on a certain website. There are 31 links on the site and each represents a calendarentry. I just want to find some links and by clicking on them the "status" changes and so I can keep this…
1
vote
2 answers

set value for selectlist in Mechanize

Consider the following Mechanize form object #
1
vote
2 answers

is it possible to convert Mechanize::File into Mechanize::Page

I'm having a trouble with Mechanize gem, how to convert Mechanize::File into Mechanize::Page, here's my piece of code: **link** = page.link_with(:href => %r{/en/users}).click when users link clicked it goes to the page with the list of users, now…
Said Kaldybaev
  • 9,380
  • 8
  • 36
  • 53
0
votes
1 answer

Use Ruby Mechanize to simulate file uploading by Flash

I want to use Ruby Mechanize to write an auto file uploading script for a website. But the read upload step of the website is done by a Flash file. I use fiddler captured the traffic from the Flash file to the server. Here is it. POST /upload.php…
Just a learner
  • 26,690
  • 50
  • 155
  • 234
0
votes
1 answer

Ruby Mechanize ignore cookie in response

I'm playing with Ruby Mechanize with a website. But it seems that it ignored one of the set-cookie header on the response. Please see my code and the result. The u=__LOGOUT__ part is missing in the result of agent.cookies. Why? Thanks. require…
Just a learner
  • 26,690
  • 50
  • 155
  • 234
0
votes
1 answer

Mechanize on Ruby 1.9.3 encoding issue

Using the following code (from the Mechanize site but in a rake task).. namespace :ans do task :grab => :environment do a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' } begin a.get('http://google.com/') do |page| …
iOSDevil
  • 1,786
  • 3
  • 16
  • 29
0
votes
0 answers

Not able to scrape linked-in profile in production using Ruby Gems(Ruby on Rails application)

I am using the following ruby code to scrape LinkedIn public profile using following ruby gems 1) Using 'mechanize' gem require 'rubygems' require 'mechanize' require 'nokogiri' require 'open-uri' agent = Mechanize.new { |agent|…
vivek
  • 35
  • 7
0
votes
1 answer

How to use Mechanize to parse local file

I'm using Ruby and Mechanize to parse a local HTML file but I can't do it. This works if I use a URL though: agent = Mechanize.new #THIS WORKS #url = 'http://www.sample.com/sample.htm' #page = agent.get(url) #this seems to work just fine but the…
heebee313
  • 325
  • 1
  • 5
  • 16
0
votes
0 answers

Get connection details in ruby mechanize

I'm having problems with a web scraper in Ruby. I'm using Mechanize gem. Is there any way to get the local port used in the agent connection? It would be very useful for my problem. For instance, in TCPSockets, I can call: 2.3.3 :029 > t =…
user2553863
  • 682
  • 1
  • 8
  • 17