Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

by Corion (Patriarch)
on Nov 19, 2013 at 12:37 UTC ( #1063320=note: print w/replies, xml ) Need Help??

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

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.

  • Comment on Re^3: Reading a cookie from an active browser session

Replies are listed 'Best First'.
Re^4: Reading a cookie from an active browser session
by xorl (Deacon) on Nov 20, 2013 at 15:55 UTC
    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.

      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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2022-08-18 10:15 GMT
Find Nodes?
    Voting Booth?

    No recent polls found