Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: Reading a cookie from an active browser session

by xorl (Deacon)
on Nov 20, 2013 at 15:55 UTC ( #1063548=note: print w/replies, xml ) Need Help??


in reply to Re^3: Reading a cookie from an active browser session
in thread Reading a cookie from an active browser session

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.

Replies are listed 'Best First'.
Re^5: Reading a cookie from an active browser session
by Corion (Patriarch) on Nov 20, 2013 at 16:05 UTC

    Maybe you just have a lot of cookies? HTTP::Cookies::MozRepl is slow.

    You could switch on the logging for your MozRepl client to see whether it is hanging or still doing something.

      In the firefox scratchpad when I do alert(document.cookie) there are only a handful of cookies (like 7 or so). So I don't think it is too many cookies.

      The problem looks like mozrepl. When I telnet to it, and do alert(document.cookie) the alert says undef. I have a sinking feeling I'm being hit by that security feature that prohibits javascript from being run in the address bar and other places.

      Trying now to figure out how to turn on logging.

        So the problem was you have to pass Mozrepl something like:

        repl.enter

        I wish thiss MozRepl thing was better documented.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-08-09 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?