Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying path for storing cookies #547

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ ghostdriver.Session = function(desiredCapabilities) {
},
_windows = {}, //< NOTE: windows are "webpage" in Phantom-dialect
_currentWindowHandle = null,
_cookieJar = require('cookiejar').create(),
_cookieJar,
_cookiePath = null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default should be an empty string to be consistent with the phantomjs source. though i'd prefer to be conservative and pass no arguments when this option is not used.

_id = require("./third_party/uuid.js").v1(),
_inputs = ghostdriver.Inputs(),
_capsPageSettingsPref = "phantomjs.page.settings.",
Expand All @@ -139,6 +140,12 @@ ghostdriver.Session = function(desiredCapabilities) {
_log = ghostdriver.logger.create("Session [" + _id + "]"),
k, settingKey, headerKey, proxySettings;

if (desiredCapabilities['phantomjs.cookies.path']) {
_cookiePath = desiredCapabilities['phantomjs.cookies.path'];
_negotiatedCapabilities['phantomjs.cookies.path'] = _cookiePath;
}
_cookieJar = require('cookiejar').create(_cookiePath);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default case should be the same. require('cookiejar').create()


var
/**
* Parses proxy JSON object and return proxy settings for phantom
Expand Down