Skip to content

Instantly share code, notes, and snippets.

@shuynh
Created November 18, 2014 22:23
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 shuynh/0573b01babcbe0b57ca9 to your computer and use it in GitHub Desktop.
Save shuynh/0573b01babcbe0b57ca9 to your computer and use it in GitHub Desktop.
var require = patchRequire(require),
config = require('../config.js'),
utils = require('../utils/utils'),
x = require('casper').selectXPath;
function getCookie(name) {
function escape(s) { return s.replace(/([.*+?\^${}()|\[\]\/\\])/g, '\\$1'); };
var match = document.cookie.match(RegExp('(?:^|;\\s*)' + escape(name) + '=([^;]*)'));
return match ? match[1] : null;
}
casper.test.begin('COOKIE COOKIE COOKIE COOKIE', function(test) {
casper.start('http://vimeo.com/', function() {
this.echo(getCookie("vuid"));
});
casper.run(function() {
this.test.done();
});
casper.then(function() {
this.exit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment