Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Reading a cookie from an active browser session

by Corion (Patriarch)
on Nov 07, 2013 at 17:00 UTC ( #1061602=note: print w/replies, xml ) Need Help??


in reply to Reading a cookie from an active browser session

If you're willing to install the mozrepl plugin, WWW::Mechanize::Firefox, resp. HTTP::Cookies::MozRepl can give you all current cookies from the connected Firefox process.

Replies are listed 'Best First'.
Re^2: Reading a cookie from an active browser session
by xorl (Deacon) on Nov 19, 2013 at 12:33 UTC
    So I installed the mozrepl plugin. telnet localhost 4242 seems to work fine. So I went to install the Perl module, but it won't install:
    Result: FAIL Failed 81/86 test programs. 14/90 subtests failed. make: *** [test_dynamic] Error 2 CORION/WWW-Mechanize-Firefox-0.74.tar.gz one dependency not OK (MozRepl::RemoteObject); additionally test harne +ss failed /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, t +ry: reports CORION/WWW-Mechanize-Firefox-0.74.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: ZIGOROU/MozRepl-0.06.tar.gz : make_test NO CORION/MozRepl-RemoteObject-0.37.tar.gz : make_test NO one depen +dency not OK (MozRepl) CORION/WWW-Mechanize-Firefox-0.74.tar.gz : make_test NO one depen +dency not OK (MozRepl::RemoteObject); additionally test harness faile +d cpan[2]> reports CORION/WWW-Mechanize-Firefox-0.74.tar.gz Distribution: C/CO/CORION/WWW-Mechanize-Firefox-0.74.tar.gz CPAN::DistnameInfo not installed; cannot continue

    From what i could tell most fail with:

    Can't locate MozRepl/RemoteObject.pm in @INC

    So I tried installing MozRepl::RemoteObject

    Result: PASS CORION/MozRepl-RemoteObject-0.37.tar.gz Tests succeeded but one dependency not OK (MozRepl) CORION/MozRepl-RemoteObject-0.37.tar.gz [dependencies] -- NA Running make install make test had returned bad status, won't install without force Failed during this command: ZIGOROU/MozRepl-0.06.tar.gz : make_test NO CORION/MozRepl-RemoteObject-0.37.tar.gz : make_test NO one depen +dency not OK (MozRepl)
    so I tried installing just MozRepl
    Result: FAIL Failed 5/14 test programs. 10/42 subtests failed. make: *** [test_dynamic] Error 255 ZIGOROU/MozRepl-0.06.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, t +ry: reports ZIGOROU/MozRepl-0.06.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: ZIGOROU/MozRepl-0.06.tar.gz : make_test NO

    There's so much gobliktygook from that one I can't make heads or tails as to what tests failed or why. I'd post it here but it is really really really long and I wouldn't expect anyone to look through it.

    So basically I need another solution :(

      MozRepl is not maintained by me. It fails its tests, I think mostly on Windows for a long time.

      I recommend you force-install MozRepl and then continue with the rest.

        Ok I did the force install. Now I tried the following code:
        use strict; use warnings; use Data::Dumper; $ENV{MOZREPL} = "localhost:8888"; # using a non-standard port since 4 +242 is used by ncui use HTTP::Cookies::MozRepl; my $repl = MozRepl::RemoteObject->install_bridge(); my $document = $repl->expr('document'); print $document->{title};

        This prints out the correct title: Junos Pulse Secure Access Service - Home - Mozilla Firefox

        So I added:

        my $cookie_jar = HTTP::Cookies::MozRepl->new( repl => $repl ); my @cookies = $cookie_jar->extract_cookies(); print Dumper \@cookies;

        Now it just hangs there, it doesn't even print the title.

        Any ideas what am I doing wrong?

        Thanks in advance.

      I just installed WWW::Mechanize::Firefox v0.74 using cpan on Windows 7 under Cygwin, with no -force and no problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1061602]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2022-08-07 15:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?