From 056aa50c19b31de967ec7c30e59c6cb16680e48d Mon Sep 17 00:00:00 2001 From: Ivan De Marino Date: Sun, 12 Jan 2014 21:08:21 +0000 Subject: [PATCH] Importing GhostDriver 1.1.1. Yes, 1.1.0 has just been imported. But the key feature in 1.1.1 is Session Isolation in WebDriver: something that has been requested many times, particularly when using GhostDriver with Selenium Grid. --- src/ghostdriver/lastupdate | 8 ++++---- src/ghostdriver/main.js | 2 +- src/ghostdriver/session.js | 22 ++++++++++++++++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/ghostdriver/lastupdate b/src/ghostdriver/lastupdate index cfa19977..e3ba4bbf 100644 --- a/src/ghostdriver/lastupdate +++ b/src/ghostdriver/lastupdate @@ -1,7 +1,7 @@ -2014-01-04 16:44:10 +2014-01-12 21:02:05 -commit 491a60b0adf78e6d7a4eff980de81bb3eb8c764d (HEAD, refs/remotes/origin/master, refs/remotes/origin/HEAD, refs/heads/master) +commit 24452f72b6daa0a8ba14822172012d781c89fbcb (HEAD, tag: refs/tags/1.1.1, refs/heads/master) Author: Ivan De Marino -Date: Thu Jan 2 23:02:21 2014 +0000 +Date: Sun Jan 12 20:37:01 2014 +0000 - Updated CHANGELOG to mention upgraded Atoms in 1.1.0 + Changing only the Driver (no need for the Java Bindings) to 1.1.1 diff --git a/src/ghostdriver/main.js b/src/ghostdriver/main.js index 8bc20b40..ad802338 100644 --- a/src/ghostdriver/main.js +++ b/src/ghostdriver/main.js @@ -35,7 +35,7 @@ ghostdriver = { hub : require("./hub_register.js"), logger : require("./logger.js"), config : null, //< this will be set below - version : "1.1.0" + version : "1.1.1" }; // create logger diff --git a/src/ghostdriver/session.js b/src/ghostdriver/session.js index dbf148d2..2bf72471 100644 --- a/src/ghostdriver/session.js +++ b/src/ghostdriver/session.js @@ -101,6 +101,7 @@ ghostdriver.Session = function(desiredCapabilities) { }, _windows = {}, //< NOTE: windows are "webpage" in Phantom-dialect _currentWindowHandle = null, + _cookieJar = require('cookiejar').create(), _id = require("./third_party/uuid.js").v1(), _inputs = ghostdriver.Inputs(), _capsPageSettingsPref = "phantomjs.page.settings.", @@ -284,8 +285,12 @@ ghostdriver.Session = function(desiredCapabilities) { _addNewPage = function(newPage) { _log.debug("_addNewPage"); - _decorateNewWindow(newPage); //< decorate the new page - _windows[newPage.windowHandle] = newPage; //< store the page/window + // decorate the new Window/Page + newPage = _decorateNewWindow(newPage); + // set session-specific CookieJar + newPage.cookieJar = _cookieJar; + // store the Window/Page by WindowHandle + _windows[newPage.windowHandle] = newPage; }, // Delete any closing page from the "_windows" container of this session @@ -487,9 +492,15 @@ ghostdriver.Session = function(desiredCapabilities) { // Ensure a Current Window is available, if it's found to be `null` if (_currentWindowHandle === null) { - // First call to get the current window: need to create one - page = _decorateNewWindow(require("webpage").create()); + // Create the first Window/Page + page = require("webpage").create(); + // Decorate it with listeners and helpers + page = _decorateNewWindow(page); + // set session-specific CookieJar + page.cookieJar = _cookieJar; + // Make the new Window, the Current Window _currentWindowHandle = page.windowHandle; + // Store by WindowHandle _windows[_currentWindowHandle] = page; } }, @@ -616,6 +627,9 @@ ghostdriver.Session = function(desiredCapabilities) { for (k in _windows) { _closeWindow(k); } + + // Release CookieJar resources + _cookieJar.close(); }, _getLog = function (type) {