Skip to content

Instantly share code, notes, and snippets.

@bitbonsai
Created July 8, 2013 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitbonsai/5953093 to your computer and use it in GitHub Desktop.
Save bitbonsai/5953093 to your computer and use it in GitHub Desktop.
PhantomJs getting cookie value
@bitbonsai
Copy link
Author

var page = require('webpage').create();
page.viewportSize = { width: 1024, height: 768 };
page.open('http://www.dell.com/uy/en/p/?l=en&scrub=44878B', function (status) {
    if (status !== 'success') {
        console.log('Unable to access the network!');
    } else {
        var cook = phantom.cookies;

        for (var i = 0; i < cook.length; i++) {
            if (cook[i]['name'] === 'mbox') {
                console.log(cook[i]['value']);
            }
        };
        var end = new Date().getTime();
    }
    phantom.exit();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment