Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

WWW::Mechanize::Chrome Created Using incognito windows by default

by shadowclaw (Novice)
on Jul 16, 2020 at 21:11 UTC ( [id://11119432]=perlquestion: print w/replies, xml ) Need Help??

shadowclaw has asked for the wisdom of the Perl Monks concerning the following question:

Hey All,

Been using WWW::Mechanize::Chrome for a while now to do some automation and while it never bothered me it would open a regular Chromium window + an Incognito window, and all my controls would then happen within the incognito window. I've now run into a scenario where the incognito window is causing an issue but for the life of me I can't figure out how to get it to stop.

Even with just a basic test constructor with "incognito => 0" it still opens. I've tried tons of combinations without success, I've even tried adding {"IncognitoModeAvailability": 1 } to the chromium config files to disable it completely, this just causes the script to error out.
Opening the browser manually does not cause incognito windows to open.

my $URL = shift || 'https://perlmonks.org'; my $mech = WWW::Mechanize::Chrome->new( headless => 0, incognito => 0, + separate_session => 1, launch_exe => '/usr/bin/chromium-browser' ); $mech->get($URL);
Hopefully I'm just missing something stupid which is usually the case.

Ubuntu 18.04 / Perl v5.26.1 / WWW::Mechanize::Chrome 0.58 / Chromium 83.0.4103.61

Any help is appreciated

Replies are listed 'Best First'.
Re: WWW::Mechanize::Chrome Created Using incognito windows by default
by marto (Cardinal) on Jul 17, 2020 at 07:37 UTC

    A quick test of your code and I can replicate the issue you find, however removing separate_session => 1 results in a normal window opening. Running your code as is actually spawns two Chrome windows, the one at the forefront is an incognito window, the one behind is not. I'd start digging around the WWW::Mechanize::Chrome source, examining the config/launch parts.

Re: WWW::Mechanize::Chrome Created Using incognito windows by default
by bliako (Monsignor) on Jul 17, 2020 at 10:46 UTC
      Thanks for this, it does seem like a bug. I'll play with some of these workaround options.
Re: WWW::Mechanize::Chrome Created Using incognito windows by default
by thomas895 (Deacon) on Jul 17, 2020 at 03:56 UTC

    Not directly related to WWW::Mechanize but in the Selenium world it's difficult to reuse your main profile, if that's what you're trying to do. It has something to do with the fact that you can't have multiple instances touching the profile files.
    So it may be that you're getting a new profile each time which appears to be incognito to websites.

    -Thomas
    "Excuse me for butting in, but I'm interrupt-driven..."
      Actually just the opposite I want each session to be completely clean.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11119432]
Approved by hippo
Front-paged by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found