简体   繁体   中英

WWW::Mechanize::Firefox - remove welcome text

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');

<>; 

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM