0

Whenever I start a WWW::Mechanize::Firefox Perl script, the first thing that loads into the browser screen are the words "WWW::Mechanize::Firefox".

How do I disable this?

My Perl code

#!perl -w

use strict;

use WWW::Mechanize::Firefox;

my $mech = WWW::Mechanize::Firefox->new( activate => 1 ); # bring the tab to the foreground

$mech->get('perlworkshop.de');

<>; 
Community
  • 1
  • 1
Jeremy Gwa
  • 2,333
  • 7
  • 25
  • 31
  • 1
    Could you share your code? – Chankey Pathak Sep 07 '16 at 09:34
  • #!perl -w use strict; use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new( activate => 1, # bring the tab to the foreground ); $mech->get('http://www.perlworkshop.de'); <>; – Jeremy Gwa Sep 07 '16 at 10:32
  • @JeremyGwa: Please don't put code in comments: it is impossible to read. You should *edit* your question to give additional information. – Borodin Sep 07 '16 at 10:44

1 Answers1

1

The banner is only displayed when WWW::Mechanize::Firefox creates a new browser tab to work with, so the obvious way is to use an existing tab in the browser

If this isn't convenient then you must create a new Firefox::Application object, and use that to create a tab of your own without the banner

The problem is that WWW::Mechanize::Firefox ordinarily passes its options to both of these steps, and writing the code manually breaks that connection. The best way is perhaps to subclass WWW::Mechanize::Firefox to provide a new constructor that behaves to your liking

May I ask why you want to do this? What is the nature of your application that you need to see specific results on the browser?

Borodin
  • 126,100
  • 9
  • 70
  • 144