in reply to WWW::Mechanize::Firefox throwing error when launching a new Firefox instance on Mac

This is most likely a bug in WWW::Mechanize::Firefox. I guess that it finds an existing navigator window but that this window is hidden on the Mac and does not allow new tabs to be created in it.

I'm not sure how to debug this as I don't have a Mac, so in the meantime the workaround will have to be that you launch Firefox separately and ensure that at least one window is open.

  • Comment on Re: WWW::Mechanize::Firefox throwing error when launching a new Firefox instance on Mac
  • Download Code

Replies are listed 'Best First'.
Re^2: WWW::Mechanize::Firefox throwing error when launching a new Firefox instance on Mac
by nysus (Parson) on Feb 28, 2013 at 13:45 UTC
    Thanks for your help. After some trial and error, I found the following workaround to the bug:
    $ff = Firefox::Application->new( launch => '/Applications/Firefox.app/Contents/MacOS/firefox', ); $ff->quit( restart => 1 ); # restart sleep 2;

    This launches a new FF application no matter what, then restarts it. Then I found you have to sleep for a bit before you can call WWW::Mechanize::Firefox->new and go to work browsing in the tab.

    If there is a way I can help you troubleshoot this, let me know. I've got a spare mac and I can give you control over it in a guest account via vnc. Maybe that would work.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
    $nysus = $PM . $MCF;
    Click here if you love Perl Monks