Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Importing latest GhostDriver, tag "1.0.0".

  • Loading branch information...
commit 4caa71a6b77ba710768d1ad855f08693f24e634c 1 parent ffa9fab
@detro detro authored committed
View
7 src/ghostdriver/README.md
@@ -0,0 +1,7 @@
+# PLEASE DON'T CHANGE THIS FILE
+This file is auto-generated by export scripts **from GhostDriver to PhantomJS**.
+If you want to make changes to GhostDriver source,
+please refer to that project instead: `https://github.com/detro/ghostdriver`.
+
+Thanks,
+[Ivan De Marino](http://ivandemarino.me)
View
4 src/ghostdriver/errors.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
View
61 src/ghostdriver/hub_register.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -28,8 +28,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* generate node configuration for this node */
var nodeconf = function(ip, port, hub) {
var ref$, hubHost, hubPort;
- ref$ = hub.match(/([\w\d\.]+):(\d+)/), hubHost = ref$[1], hubPort = ref$[2];
- hubPort = +hubPort;
+
+ ref$ = hub.match(/([\w\d\.]+):(\d+)/);
+ hubHost = ref$[1];
+ hubPort = +ref$[2]; //< ensure it's of type "number"
+
return {
capabilities: [{
browserName: "phantomjs",
@@ -56,29 +59,33 @@ var nodeconf = function(ip, port, hub) {
module.exports = {
register: function(ip, port, hub) {
- var page = require('webpage').create();
- port = +port;
- if(!hub.match(/\/$/)) {
- hub += '/';
- }
-
- /* Register with selenium grid server */
- page.open(hub + 'grid/register', {
- operation: 'post',
- data: JSON.stringify(nodeconf(ip, port, hub)),
- headers: {
- 'Content-Type': 'application/json'
+ try {
+ var page = require('webpage').create();
+ port = +port; //< ensure it's of type "number"
+ if(!hub.match(/\/$/)) {
+ hub += '/';
}
- }, function(status) {
- if(status !== 'success') {
- console.error("Unable to contact grid " + hub + ": " + status);
- phantom.exit(1);
- }
- if(page.framePlainText !== "ok") {
- console.error("Problem registering with grid " + hub + ": " + page.content);
- phantom.exit(1);
- }
- console.log("Registered with grid hub: " + hub + " (" + page.framePlainText + ")");
- });
+
+ /* Register with selenium grid server */
+ page.open(hub + 'grid/register', {
+ operation: 'post',
+ data: JSON.stringify(nodeconf(ip, port, hub)),
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }, function(status) {
+ if(status !== 'success') {
+ console.error("Unable to contact grid " + hub + ": " + status);
+ phantom.exit(1);
+ }
+ if(page.framePlainText !== "ok") {
+ console.error("Problem registering with grid " + hub + ": " + page.content);
+ phantom.exit(1);
+ }
+ console.log("Registered with grid hub: " + hub + " (" + page.framePlainText + ")");
+ });
+ } catch (e) {
+ throw new Error("Could not register to Selenium Grid Hub: " + hub);
+ }
}
};
View
15 src/ghostdriver/inputs.js
@@ -1,18 +1,17 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
-Copyright (c) 2012, Jim Evans <james.h.evans.jr@gmail.com>
+Copyright (c) 2010, Jim Evans <james.h.evans.jr@gmail.com> - Salesforce.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
View
11 src/ghostdriver/lastupdate
@@ -1,7 +1,10 @@
-2012-11-18 00:51:11
+2012-11-25 20:54:35
-commit 7c23d7684929bf26deb5be901ba1e5bc51f3e48a
+commit 54876580d0a3886e42850804b03184adbd899d65 (HEAD, tag: refs/tags/1.0.0, refs/remotes/origin/master, refs/remotes/origin/HEAD, refs/heads/master)
Author: Ivan De Marino <ivan.de.marino@gmail.com>
-Date: Sun Nov 18 00:42:32 2012 +0000
+Date: Sun Nov 25 19:05:15 2012 +0000
- Avoid listing directories into `ghostdriver.qrc`
+ Updated export script.
+
+ 1. Creates the `README.md` to inform PhantomJS developers that the code is automatically exported from GhostDriver
+ 2. Adds `--decorate=full` to the line where we populate the `lastupdate` file
View
54 src/ghostdriver/main.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -28,15 +28,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Load dependencies
// NOTE: We need to provide PhantomJS with the "require" module ASAP. This is a pretty s**t way to load dependencies
var ghostdriver = {
- system : require('system'),
- hub : require('./hub_register')
+ system : require('system'),
+ hub : require('./hub_register'),
+ version : "1.0.0"
},
server = require('webserver').create(),
router,
parseURI,
listenOn,
listenOnIp = "127.0.0.1",
- listenOnPort = "8080";
+ listenOnPort = "8910";
// Enable "strict mode" for the 'parseURI' library
parseURI = require("./third_party/parseuri.js");
@@ -53,29 +54,34 @@ phantom.injectJs("request_handlers/webelement_request_handler.js");
phantom.injectJs("request_handlers/router_request_handler.js");
phantom.injectJs("webelementlocator.js");
-// HTTP Request Router
-router = new ghostdriver.RouterReqHand();
+try {
+ // HTTP Request Router
+ router = new ghostdriver.RouterReqHand();
-// Check if parameters were given, regarding the "ip:port" to listen to
-if (ghostdriver.system.args[1]) {
- if (ghostdriver.system.args[1].indexOf(':') >= 0) {
- listenOn = ghostdriver.system.args[1].split(':');
- listenOnIp = listenOn[0];
- listenOnPort = listenOn[1];
- } else {
- listenOnPort = ghostdriver.system.args[1];
+ // Check if parameters were given, regarding the "ip:port" to listen to
+ if (ghostdriver.system.args[1]) {
+ if (ghostdriver.system.args[1].indexOf(':') >= 0) {
+ listenOn = ghostdriver.system.args[1].split(':');
+ listenOnIp = listenOn[0];
+ listenOnPort = listenOn[1];
+ } else {
+ listenOnPort = ghostdriver.system.args[1];
+ }
}
-}
-// Start the server
-if (server.listen(listenOnPort, router.handle)) {
- console.log('Ghost Driver running on port ' + server.port);
+ // Start the server
+ if (server.listen(listenOnPort, router.handle)) {
+ console.log('Ghost Driver running on port ' + server.port);
- // If parameters regarding a Selenium Grid HUB were given, register to it!
- if (ghostdriver.system.args[2]) {
- ghostdriver.hub.register(listenOnIp, listenOnPort, ghostdriver.system.args[2]);
+ // If parameters regarding a Selenium Grid HUB were given, register to it!
+ if (ghostdriver.system.args[2]) {
+ ghostdriver.hub.register(listenOnIp, listenOnPort, ghostdriver.system.args[2]);
+ }
+ } else {
+ throw new Error("ERROR: Could not start Ghost Driver");
+ phantom.exit(1);
}
-} else {
- console.error("ERROR: Could not start Ghost Driver");
+} catch (e) {
+ console.error(e);
phantom.exit(1);
}
View
4 src/ghostdriver/request_handlers/request_handler.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
View
4 src/ghostdriver/request_handlers/router_request_handler.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
View
4 src/ghostdriver/request_handlers/session_manager_request_handler.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
View
8 src/ghostdriver/request_handlers/session_request_handler.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
Copyright (c) 2012, Alex Anderson <@alxndrsn>
All rights reserved.
@@ -317,7 +317,7 @@ ghostdriver.SessionReqHand = function(session) {
if (currWindow.canGoBack) {
currWindow.execFuncAndWaitForLoad(
- function() { currWindow.back(); },
+ function() { currWindow.goBack(); },
successHand,
successHand); //< We don't care if 'back' fails
} else {
@@ -332,7 +332,7 @@ ghostdriver.SessionReqHand = function(session) {
if (currWindow.canGoForward) {
currWindow.execFuncAndWaitForLoad(
- function() { currWindow.forward(); },
+ function() { currWindow.goForward(); },
successHand,
successHand); //< We don't care if 'back' fails
} else {
View
4 src/ghostdriver/request_handlers/shutdown_request_handler.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
Copyright (c) 2010, Jim Evans <james.h.evans.jr@gmail.com> - Salesforce.com
All rights reserved.
View
4 src/ghostdriver/request_handlers/status_request_handler.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
View
4 src/ghostdriver/request_handlers/webelement_request_handler.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
Copyright (c) 2012, Alex Anderson <@alxndrsn>
All rights reserved.
View
8 src/ghostdriver/session.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -32,7 +32,9 @@ ghostdriver.Session = function(desiredCapabilities) {
var
_defaultCapabilities = { // TODO - Actually try to match the "desiredCapabilities" instead of ignoring them
"browserName" : "phantomjs",
- "version" : phantom.version.major + '.' + phantom.version.minor + '.' + phantom.version.patch,
+ "version" :
+ "phantomjs-" + phantom.version.major + '.' + phantom.version.minor + '.' + phantom.version.patch + '+' +
+ "ghostdriver-" + ghostdriver.version,
"platform" : ghostdriver.system.os.name + '-' + ghostdriver.system.os.version + '-' + ghostdriver.system.os.architecture,
"javascriptEnabled" : true,
"takesScreenshot" : true,
View
4 src/ghostdriver/third_party/parseuri.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
Copyright (c) 2011, Steven Levithan <stevenlevithan.com>
All rights reserved.
View
4 src/ghostdriver/webdriver_atoms.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
View
4 src/ghostdriver/webelementlocator.js
@@ -1,7 +1,7 @@
/*
-This file is part of the GhostDriver project from Neustar inc.
+This file is part of the GhostDriver by Ivan De Marino <http://ivandemarino.me>.
-Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Ivan De Marino <http://ivandemarino.me>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Please sign in to comment.
Something went wrong with that request. Please try again.