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
1 answer

How can you use Python to fill out HTML forms that also have Javascript?

I am making a python program that automatically enters information into a form on a website. I looked at a module called mechanize at first but then I realized that it didn't support javascript. Is there any way to take a piece of information and…
jacob501
  • 345
  • 2
  • 5
  • 17
0
votes
1 answer

Ruby mechanize script in python

I've got this ruby script: require 'mechanize' agent = Mechanize.new page = agent.get "http://www.speech.sri.com/projects/srilm/download.html" form = page.forms.last form.field_with(name: "name").value = "Hans Meier" form.field_with(name:…
Reactormonk
  • 21,472
  • 14
  • 74
  • 123
0
votes
3 answers

What should I do with hanging http POST request in python?

Sample code: socket.setdefaulttimeout(150) MechBrowser = mechanize.Browser() Header = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 GTB7.1 (.NET CLR 3.5.30729)'} Url =…
Shane
  • 4,875
  • 12
  • 49
  • 87
0
votes
1 answer

Installing Perl's WWW::Mechanize::Firefox on OpenSuSE 11.4 - resulting in some annoying errors

Running OpenSuSE 11.4 - and trying to install WWW::Mechanize::Firefox. Well I guess that I am missing MAKE (which is obviously GNU make - isn't it?) See the following... cpan[1]> install WWW::Mechanize::Firefox Going to read…
zero
  • 1,003
  • 3
  • 20
  • 42
0
votes
1 answer

Redirected to a bad URI with Mechanize raises an invalid URI error

I am trying to communicate with a badly designed web server, but still I want to deal with it. The thing is, when I submit my login form, it tries to embed messages inside the URI, which makes the URI library stop. The server redirects me to…
Jonathan Allard
  • 18,429
  • 11
  • 54
  • 75
0
votes
2 answers

read some variables out of a directory - in order to parse them with mechanize

I have a list of 2500 websites and need to grab a thumbnail screenshot of them. How do I do that? I could try to parse the sites either with Perl Mechanize - eg like this. use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); …
zero
  • 1,003
  • 3
  • 20
  • 42
0
votes
1 answer

missing POST variables from webrat's button_press

I have been running into trouble while trying to test my php web application with cucumber. Basically, the button_press method fails to submit the buttonName_x and buttonName_y POST variables when submitting the form. I hope someone is able to help…
Andreas Grapentin
  • 5,499
  • 4
  • 39
  • 57
0
votes
2 answers

How to POST a file in Python mechanize, but without any form?

How can I make POST request with a file in Python mechanize, but without any existing form, I just need to POST a file "out of the blue". There are some examples of file upload on stackoverflow but all relate to attaching a file in a form. I just…
ria
  • 7,198
  • 6
  • 29
  • 35
0
votes
1 answer

Python: Unable to import mechanize module on Mac

I have mechanize module installed using easy_install but when I tried to import I get the following error: Python 2.6.7 (r267:88850, Nov 21 2011, 14:59:21) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or…
add-semi-colons
  • 18,094
  • 55
  • 145
  • 232
0
votes
1 answer

Using Python to automate the use of online file converter

How do I use Python to automate the file conversion of SBML (XML) files, stored locally, using a web-based file converter located here: http://www.ebi.ac.uk/compneur-srv/converters/converters Here are the steps for manually doing this: 1. Select…
user1027169
  • 2,627
  • 3
  • 27
  • 50
0
votes
1 answer

Can't figure out how to use Mechanize with Python to select items from a dropdown box on an ASP.NET page

I have an ASP.NET page (located here: http://www.kraftrecipes.com/Products/ProductMain.aspx) that has a dropdown box of various food brands. I'm trying to use Mechanize in Python so I can click on each item in the list, go to the product list page,…
user1074600
0
votes
1 answer

Why is the http request hanging in my python script?

One of my script runs perfectly on an XP system, but the exact script hangs on a 2003 system. I always use mechanize to send the http request, here's an example: import socket, mechanize, urllib, urllib2 socket.setdefaulttimeout(60) #### No idea…
Shane
  • 4,875
  • 12
  • 49
  • 87
0
votes
1 answer

using mechanize to post on wordpress

Long story short I need to post automated comments to my WordPress blog. I find mechanize for Python (hurray! no need to muck around in PHP!) but I can't post comments with it. According to the debug info I logged in successfully and returned to the…
Kristoff vdH
  • 224
  • 2
  • 4
0
votes
1 answer

Mechanize to scrape using 2 searches?

I am scraping a blog using Mechanize trying to get the results below. Mainly having trouble turning my thoughts into code logic. I assume I need to combine the search clauses and iterate through the html and prints out as it finds matches. New to…
TheRealDK
  • 367
  • 3
  • 16
0
votes
1 answer

Centos 5.7 / ruby / nokogiri - Getting NotFoundError xmlRelaxNGSetParserStructuredErrors

Getting this error: # rails c FFI::NotFoundError: Function 'xmlRelaxNGSetParserStructuredErrors' not found in [libxml2.so, libxslt.so, libexslt.so] attach_function at…
Chris Kimpton
  • 5,546
  • 6
  • 45
  • 72