Questions tagged [mechanize]

Mechanize is a library for automated web browsing originally developed for Perl, there are now also Python and Ruby implementations.

Mechanize is a Ruby library 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. It is adapted from the Perl module. There is also a for Python.

2512 questions
0
votes
3 answers

Ensure a page has downloaded correctly in Python

I am writing a basic screen scraping script using Mechanize and BeautifulSoup (BS) in Python. However, the problem I am running into is that for some reason the requested page does not download correctly every time. I am concluding this because when…
Neal Sidd
  • 39
  • 5
0
votes
0 answers

Mechanize: undefined method 'info' for Nil class in Ruby 1.9.3

I'm trying to use the Ruby gem Mechanize in an app I'm building, but I'm getting an error. Performing the following in IRB with Ruby 1.9.3-p0: require 'Mechanize' agent = Mechanize.new page = agent.get('http://www.google.com') Gives me the…
purpletonic
  • 1,858
  • 2
  • 18
  • 29
0
votes
3 answers

mechanize print to pdf

Possible Duplicate: How do I grab a thumbnail screenshot of many websites? I wrote a script using perl mechanize to login and fetch a page. How can I "print" that page to "pdf" directly from my perl script? I'd like to save a snapshot of how it…
user391986
  • 29,536
  • 39
  • 126
  • 205
0
votes
1 answer

Selecting dynamiclly filled drop-down with in form using python

I'm using mechanize to fill form on a website and now I run into a problem with dynamically-filled drop-down lists that are dependent on a previous selection.I have four drop-downs in a form which are dynamically populated and then user can submit…
Anshul
  • 7,914
  • 12
  • 42
  • 65
0
votes
1 answer

ruby mechanize requires full class name

why do you need the full name for mechanize as so: #!/usr/bin/ruby -w require 'rubygems' require 'pp' require 'yaml' require "mechanize" yml = YAML.load_file 'login.yml' user = yml["user"] pword = yml["pword"] a = WWW::Mechanize.new { |agent| …
Thufir
  • 8,216
  • 28
  • 125
  • 273
0
votes
1 answer

python mechanize._html.ParseError

When I run the code below, I get a mechanize._html.ParseError exception. How do I make it shut up? I know it's invalid html, I wouldn't want to parse it if it was a nice website. I did google around, and was told to replace br = mechanize.Browser()…
wheybags
  • 627
  • 4
  • 15
0
votes
2 answers

Why does Mechanize login keep failing?

I'm trying to login to a class site, but every time I submit the form I get the login page. I have used both ways to submit the form both resulting in the same outcome. I've printed out the form before submitting it to check and make sure all…
krizzo
  • 1,823
  • 5
  • 30
  • 52
0
votes
3 answers

How can I use python to "send" data (images) to ImageBam.com

I've read a lot about multipart/forms, mechanize and twill, but I couldn' findout howto implement a code. Using MultipartPostHandler to POST form-data with Python First I Tried to fill the forms on www.imagebam.com/basic-upload I can fill the forms…
gokcennurlu
  • 33
  • 1
  • 6
0
votes
2 answers

Not sure how to deal with javascript and mechanize in this specific instance

I'm going to be accessing a number of accounts on Amazon's KDP - http://kdp.amazon.com/ My task is to login to each account and check the account's earnings. Mechanize works great for logging in and dealing with the cookies and such but the page…
dsp_099
  • 5,801
  • 17
  • 72
  • 128
0
votes
1 answer

Mechanize and SSLError in Ruby

Using Mechanize with my ruby script, I can't get around the the well known SSLError. I'm running on rails with Windows 7 and RailsInstaller. I want to generate adcrun.ch links with my ruby script. Therefore I have to login into my adcrun.ch…
Pr0
  • 3
  • 2
0
votes
2 answers

Parse html into Rails without new record every time?

I have the following code which is parsing a HTML table as simply as possible. # Timestamp (Column 1 of the table) page = agent.page.search("tbody td:nth-child(1)").each do |item| Call.create!(:time => item.text.strip) end # Source (Column 2 of…
dannymcc
  • 3,744
  • 12
  • 52
  • 85
0
votes
1 answer

Use of Mechanize

I want to get response from websites that take a simple input, which is also reflected in the parameter of the url. Is it better to simply get the result by using conventional methods, for example OpenURI.open_uri(...) with some parameter set, or it…
sawa
  • 165,429
  • 45
  • 277
  • 381
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
1 answer

Grabbing a .jsp generated PNG in Python

I am trying to grab a PNG image which is being dynamically generated with JSP in a web service. I have tried visiting the web page it is contained in and grabbing the image src attribute; but the link leads to a .jsp file. Reading the response with…
eli
  • 4,636
  • 7
  • 25
  • 29
0
votes
2 answers

How do you open a URL with Python without using a browser?

I want to open a URL with Python code but I don't want to use the "webbrowser" module. I tried that already and it worked (It opened the URL in my actual default browser, which is what I DON'T want). So then I tried using urllib (urlopen) and…
jacob501
  • 345
  • 2
  • 5
  • 17