in reply to WWW Mechanize and JavaScript Cookie

Writing with JavaScript fails in a silent way.

Turn on debugging

Is it some configuration problem?

Looks that way

  • Comment on Re: WWW Mechanize and JavaScript Cookie

Replies are listed 'Best First'.
Re^2: WWW Mechanize and JavaScript Cookie
by saintex (Scribe) on Mar 15, 2011 at 16:01 UTC
    Thank you for your answer:

    >> Turn on debugging

    How can I enable?

    >> Looks that way

    I think it is already done, in my code I have:
    my $cook= HTTP::Cookies::Netscape->new(file => 'ciao.txt' ,ignore_disc +ard => 1,autosave=>1); $m = new WWW::Scripter(autocheck=>1,cookie_jar=>$cook) ;


    that is what you suggest to me... or I done some errors in the code?

      How can I enable?

      Ha ha, this is faq, see LWP::Debug

      FWIW, this works for me

      #!/usr/bin/perl -- use strict; use warnings; use WWW::Scripter; my $w = WWW::Scripter->new; $w->use_plugin('JavaScript'); #~ http://w3schools.com/jsref/prop_doc_cookie.asp# HTML DOM Document c +ookie Property #~ http://w3schools.com/jsref/tryit.asp?filename=tryjsref_doc_cookie #~ http://w3schools.com/jsref/tryit_view.asp?filename=tryjsref_doc_coo +kie $w->get('http://w3schools.com/jsref/tryit_view.asp?filename=tryjsref_d +oc_cookie'); print $w->cookie_jar->as_string, "\n\n"; print $w->document->body->as_text; __END__ Set-Cookie3: ASPSESSIONIDACRSCCCQ=FAKEASPSESSIONIDACRSCCCQ; path="/"; +domain=w3schools.com; path_spec; discard; version=0 Cookies associated with this document: ASPSESSIONIDACRSCCCQ=FAKEASPSESSIONIDACRSCCCQ
        But the cookie you talk about, it is not write with JavaScript, but with ASP:
        ASPSESSION

        I have not any difficult to read cookies, but I have difficult to write cookie in JavaScript.
        The cookies are not been writed.