I am working on a multi-page form filler to login to Yahoo Mail, but have run into a problem.

The code works when I run firefox in X11 with a display, but fails when I run firefox in Xvfb. Xvfb is setuid. I can watch it run in X11 with a display (which happens to be running on my mac - the server where fillform.pl runs is Debian Squeeze).

This is where the code fails in fillform.pl when I try to use Xvfb. I can see it connect to firefox from the MOZREPL log:

my $mech = WWW::Mechanize::Firefox->new() ; print "debug: going to mech->get()\n" ; $mech->get('http://mail.yahoo.com') ;

And here is the console session:

$ Xvfb :99 & $ DISPLAY=:99 firefox --display=:99 & I, MOZREPL : Listening : 127.0.0.1:4242 $ DISPLAY=:99 xdotool search --onlyvisible --title firefox 4194416 $ DISPLAY=:99 xdotool windowfocus 4194416 $ DISPLAY=:99 ~/fillform.pl I, MOZREPL : Client connected : 127.0.0.1:46357 : chrome://browser/con +tent/browser.xul I, MOZREPL : Client connected : 127.0.0.1:46358 : chrome://browser/con +tent/browser.xul debug: going to mech->get() Can't call method "addProgressListener" on an undefined value at /usr/ +local/share/perl/5.10.1/WWW/Mechanize/Firefox.pm line 574, <DATA> lin +e 1. I, MOZREPL : Client closed connection : 127.0.0.1:46358 I, MOZREPL : Client closed connection : 127.0.0.1:46357

This is line 574:

$source->addProgressListener($lsn,$NOTIFY_STATE_DOCUMENT);

In reply to Headless (Xvfb) WWW::Mechanize::Firefox by onelesd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.