Skip to content

Instantly share code, notes, and snippets.

@gempesaw
Created February 26, 2013 16:41
Show Gist options
  • Select an option

  • Save gempesaw/5039974 to your computer and use it in GitHub Desktop.

Select an option

Save gempesaw/5039974 to your computer and use it in GitHub Desktop.
webdriver set a cookie
#! /usr/bin/perl
use strict;
use warnings;
use Selenium::Remote::Driver;
my $driver = new Selenium::Remote::Driver();
$driver->get("http://www.google.com");
$driver->add_cookie('foo', 'bar', '/', '.google.com', 0);
$driver->execute_script('alert(document.cookie); return 1;');
sleep(10);
$driver->quit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment