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.