selenium-webdriver 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
- data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
- data/chrome/src/extension/background.js +64 -48
- data/chrome/src/extension/content_script.js +253 -132
- data/chrome/src/extension/manifest-nonwin.json +1 -1
- data/chrome/src/extension/manifest-win.json +1 -1
- data/chrome/src/extension/utils.js +8 -8
- data/chrome/src/rb/lib/selenium/webdriver/chrome.rb +9 -0
- data/chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb +38 -280
- data/chrome/src/rb/lib/selenium/webdriver/chrome/command_executor.rb +119 -117
- data/chrome/src/rb/lib/selenium/webdriver/chrome/launcher.rb +36 -26
- data/common/src/js/abstractcommandprocessor.js +9 -11
- data/common/src/js/command.js +159 -83
- data/common/src/js/core/RemoteRunner.html +2 -2
- data/common/src/js/core/TestRunner-splash.html +3 -3
- data/common/src/js/core/TestRunner.html +5 -17
- data/common/src/js/core/scripts/htmlutils.js +4208 -2506
- data/common/src/js/core/scripts/selenium-api.js +2 -2
- data/common/src/js/core/scripts/selenium-browserbot.js +66 -58
- data/common/src/js/core/scripts/selenium-version.js +1 -1
- data/common/src/js/localcommandprocessor.js +5 -19
- data/common/src/js/testcase.js +2 -0
- data/common/src/js/webdriver.js +63 -93
- data/common/src/js/webelement.js +40 -42
- data/common/src/rb/lib/selenium/webdriver.rb +23 -14
- data/common/src/rb/lib/selenium/webdriver/bridge_helper.rb +8 -35
- data/common/src/rb/lib/selenium/webdriver/child_process.rb +2 -0
- data/common/src/rb/lib/selenium/webdriver/core_ext/dir.rb +1 -0
- data/common/src/rb/lib/selenium/webdriver/core_ext/string.rb +5 -0
- data/common/src/rb/lib/selenium/webdriver/driver.rb +20 -15
- data/common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb +7 -2
- data/common/src/rb/lib/selenium/webdriver/element.rb +11 -2
- data/common/src/rb/lib/selenium/webdriver/error.rb +9 -5
- data/common/src/rb/lib/selenium/webdriver/keys.rb +1 -2
- data/common/src/rb/lib/selenium/webdriver/navigation.rb +16 -0
- data/common/src/rb/lib/selenium/webdriver/options.rb +32 -0
- data/common/src/rb/lib/selenium/webdriver/platform.rb +17 -1
- data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
- data/firefox/src/extension/components/dispatcher.js +492 -0
- data/firefox/src/extension/components/driver-component.js +4 -1
- data/firefox/src/extension/components/errorcode.js +70 -0
- data/firefox/src/extension/components/firefoxDriver.js +173 -154
- data/firefox/src/extension/components/nsCommandProcessor.js +171 -132
- data/firefox/src/extension/components/promptService.js +5 -5
- data/firefox/src/extension/components/request.js +219 -0
- data/firefox/src/extension/components/response.js +276 -0
- data/firefox/src/extension/components/session.js +281 -0
- data/firefox/src/extension/components/sessionstore.js +226 -0
- data/firefox/src/extension/components/socketListener.js +350 -100
- data/firefox/src/extension/components/utils.js +166 -98
- data/firefox/src/extension/components/webdriverserver.js +9 -5
- data/firefox/src/extension/components/wrappedElement.js +189 -166
- data/firefox/src/extension/install.rdf +1 -1
- data/firefox/src/rb/lib/selenium/webdriver/firefox.rb +2 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb +39 -33
- data/firefox/src/rb/lib/selenium/webdriver/firefox/bridge.rb +7 -421
- data/firefox/src/rb/lib/selenium/webdriver/firefox/extension_connection.rb +7 -64
- data/firefox/src/rb/lib/selenium/webdriver/firefox/launcher.rb +2 -3
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb +54 -10
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profiles_ini.rb +2 -0
- data/firefox/src/rb/lib/selenium/webdriver/firefox/util.rb +6 -0
- data/jobbie/prebuilt/Win32/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/src/rb/lib/selenium/webdriver/ie.rb +2 -0
- data/jobbie/src/rb/lib/selenium/webdriver/ie/bridge.rb +38 -13
- data/jobbie/src/rb/lib/selenium/webdriver/ie/lib.rb +9 -2
- data/jobbie/src/rb/lib/selenium/webdriver/ie/util.rb +5 -0
- data/remote/client/src/rb/lib/selenium/webdriver/remote.rb +2 -0
- data/remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb +42 -38
- data/remote/client/src/rb/lib/selenium/webdriver/remote/commands.rb +56 -47
- data/remote/client/src/rb/lib/selenium/webdriver/remote/default_http_client.rb +26 -26
- data/remote/client/src/rb/lib/selenium/webdriver/remote/patron_http_client.rb +58 -0
- data/remote/client/src/rb/lib/selenium/webdriver/remote/response.rb +10 -12
- data/remote/client/src/rb/lib/selenium/webdriver/remote/server_error.rb +2 -17
- metadata +44 -23
- data/common/src/js/context.js +0 -58
- data/firefox/src/extension/components/context.js +0 -37
|
@@ -950,8 +950,8 @@ Selenium.prototype.doOpen = function(url, ignoreResponseCode) {
|
|
|
950
950
|
* @param ignoreResponseCode (optional) turn off ajax head request functionality
|
|
951
951
|
*
|
|
952
952
|
*/
|
|
953
|
-
if (ignoreResponseCode == null) {
|
|
954
|
-
this.browserbot.ignoreResponseCode =
|
|
953
|
+
if (ignoreResponseCode == null || ignoreResponseCode.length == 0) {
|
|
954
|
+
this.browserbot.ignoreResponseCode = true;
|
|
955
955
|
} else if (ignoreResponseCode.toLowerCase() == "true") {
|
|
956
956
|
this.browserbot.ignoreResponseCode = true;
|
|
957
957
|
} else {
|
|
@@ -100,9 +100,11 @@ var BrowserBot = function(topLevelApplicationWindow) {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
this.isNewPageLoaded = function() {
|
|
103
|
+
var e;
|
|
104
|
+
|
|
103
105
|
if (this.pageLoadError) {
|
|
104
106
|
LOG.error("isNewPageLoaded found an old pageLoadError");
|
|
105
|
-
|
|
107
|
+
e = this.pageLoadError;
|
|
106
108
|
this.pageLoadError = null;
|
|
107
109
|
throw e;
|
|
108
110
|
}
|
|
@@ -114,7 +116,7 @@ var BrowserBot = function(topLevelApplicationWindow) {
|
|
|
114
116
|
if (!((self.xhrResponseCode >= 200 && self.xhrResponseCode <= 399) || self.xhrResponseCode == 0)) {
|
|
115
117
|
// TODO: for IE status like: 12002, 12007, ... provide corresponding statusText messages also.
|
|
116
118
|
LOG.error("XHR failed with message " + self.xhrStatusText);
|
|
117
|
-
|
|
119
|
+
e = "XHR ERROR: URL = " + self.xhrOpenLocation + " Response_Code = " + self.xhrResponseCode + " Error_Message = " + self.xhrStatusText;
|
|
118
120
|
self.abortXhr = false;
|
|
119
121
|
self.isXhrSent = false;
|
|
120
122
|
self.isXhrDone = false;
|
|
@@ -209,13 +211,13 @@ BrowserBot.prototype.relayToRC = function(name) {
|
|
|
209
211
|
var object = eval(name);
|
|
210
212
|
var s = 'state:' + serializeObject(name, object) + "\n";
|
|
211
213
|
sendToRC(s,"state=true");
|
|
212
|
-
}
|
|
214
|
+
};
|
|
213
215
|
|
|
214
216
|
BrowserBot.prototype.resetPopups = function() {
|
|
215
217
|
this.recordedAlerts = [];
|
|
216
218
|
this.recordedConfirmations = [];
|
|
217
219
|
this.recordedPrompts = [];
|
|
218
|
-
}
|
|
220
|
+
};
|
|
219
221
|
|
|
220
222
|
BrowserBot.prototype.getNextAlert = function() {
|
|
221
223
|
var t = this.recordedAlerts.shift();
|
|
@@ -257,8 +259,9 @@ BrowserBot.prototype.triggerMouseEvent = function(element, eventType, canBubble,
|
|
|
257
259
|
var screenY = 0;
|
|
258
260
|
|
|
259
261
|
canBubble = (typeof(canBubble) == undefined) ? true : canBubble;
|
|
262
|
+
var evt;
|
|
260
263
|
if (element.fireEvent && element.ownerDocument && element.ownerDocument.createEventObject) { //IE
|
|
261
|
-
|
|
264
|
+
evt = createEventObject(element, this.controlKeyDown, this.altKeyDown, this.shiftKeyDown, this.metaKeyDown);
|
|
262
265
|
evt.detail = 0;
|
|
263
266
|
evt.button = button ? button : 1; // default will be the left mouse click ( http://www.javascriptkit.com/jsref/event.shtml )
|
|
264
267
|
evt.relatedTarget = null;
|
|
@@ -290,7 +293,7 @@ BrowserBot.prototype.triggerMouseEvent = function(element, eventType, canBubble,
|
|
|
290
293
|
}
|
|
291
294
|
}
|
|
292
295
|
else {
|
|
293
|
-
|
|
296
|
+
evt = document.createEvent('MouseEvents');
|
|
294
297
|
if (evt.initMouseEvent)
|
|
295
298
|
{
|
|
296
299
|
// see http://developer.mozilla.org/en/docs/DOM:event.button and
|
|
@@ -314,7 +317,7 @@ BrowserBot.prototype.triggerMouseEvent = function(element, eventType, canBubble,
|
|
|
314
317
|
}
|
|
315
318
|
element.dispatchEvent(evt);
|
|
316
319
|
}
|
|
317
|
-
}
|
|
320
|
+
};
|
|
318
321
|
|
|
319
322
|
BrowserBot.prototype._windowClosed = function(win) {
|
|
320
323
|
var c = win.closed;
|
|
@@ -390,7 +393,7 @@ BrowserBot.prototype._selectTopWindow = function() {
|
|
|
390
393
|
this.currentWindow = this.topWindow;
|
|
391
394
|
this.topFrame = this.topWindow;
|
|
392
395
|
this.isSubFrameSelected = false;
|
|
393
|
-
}
|
|
396
|
+
};
|
|
394
397
|
|
|
395
398
|
BrowserBot.prototype._selectWindowByWindowId = function(windowId) {
|
|
396
399
|
try {
|
|
@@ -406,7 +409,7 @@ BrowserBot.prototype._selectWindowByName = function(target) {
|
|
|
406
409
|
this.topFrame = this.currentWindow;
|
|
407
410
|
this.currentWindowName = target;
|
|
408
411
|
this.isSubFrameSelected = false;
|
|
409
|
-
}
|
|
412
|
+
};
|
|
410
413
|
|
|
411
414
|
BrowserBot.prototype._selectWindowByTitle = function(target) {
|
|
412
415
|
var windowName = this.getWindowNameByTitle(target);
|
|
@@ -415,7 +418,7 @@ BrowserBot.prototype._selectWindowByTitle = function(target) {
|
|
|
415
418
|
} else {
|
|
416
419
|
this._selectWindowByName(windowName);
|
|
417
420
|
}
|
|
418
|
-
}
|
|
421
|
+
};
|
|
419
422
|
|
|
420
423
|
BrowserBot.prototype._selectFirstNonTopWindow = function() {
|
|
421
424
|
var names = this.getNonTopWindowNames();
|
|
@@ -425,9 +428,11 @@ BrowserBot.prototype._selectFirstNonTopWindow = function() {
|
|
|
425
428
|
};
|
|
426
429
|
|
|
427
430
|
BrowserBot.prototype.selectFrame = function(target) {
|
|
431
|
+
var frame;
|
|
432
|
+
|
|
428
433
|
if (target.indexOf("index=") == 0) {
|
|
429
434
|
target = target.substr(6);
|
|
430
|
-
|
|
435
|
+
frame = this.getCurrentWindow().frames[target];
|
|
431
436
|
if (frame == null) {
|
|
432
437
|
throw new SeleniumError("Not found: frames["+target+"]");
|
|
433
438
|
}
|
|
@@ -444,7 +449,7 @@ BrowserBot.prototype.selectFrame = function(target) {
|
|
|
444
449
|
this.currentWindow = this.topFrame;
|
|
445
450
|
this.isSubFrameSelected = false;
|
|
446
451
|
} else {
|
|
447
|
-
|
|
452
|
+
frame = this.findElement(target);
|
|
448
453
|
if (frame == null) {
|
|
449
454
|
throw new SeleniumError("Not found: " + target);
|
|
450
455
|
}
|
|
@@ -559,7 +564,7 @@ BrowserBot.prototype.abortXhrRequest = function() {
|
|
|
559
564
|
this.xhr.abort();
|
|
560
565
|
}
|
|
561
566
|
}
|
|
562
|
-
}
|
|
567
|
+
};
|
|
563
568
|
|
|
564
569
|
BrowserBot.prototype.onXhrStateChange = function(method) {
|
|
565
570
|
LOG.info("onXhrStateChange(): xhr.readyState = " + this.xhr.readyState + " method = " + method + " time = " + new Date().getTime());
|
|
@@ -615,7 +620,7 @@ BrowserBot.prototype.checkedOpen = function(target) {
|
|
|
615
620
|
this.xhr.open("HEAD", url, true);
|
|
616
621
|
this.xhr.send("");
|
|
617
622
|
this.isXhrSent = true;
|
|
618
|
-
}
|
|
623
|
+
};
|
|
619
624
|
|
|
620
625
|
BrowserBot.prototype.openLocation = function(target) {
|
|
621
626
|
// We're moving to a new page - clear the current one
|
|
@@ -790,7 +795,7 @@ BrowserBot.prototype._isHTASubFrame = function(win) {
|
|
|
790
795
|
if (!browserVersion.isHTA) return false;
|
|
791
796
|
// DGF this is wrong! what if "win" isn't the selected window?
|
|
792
797
|
return this.isSubFrameSelected;
|
|
793
|
-
}
|
|
798
|
+
};
|
|
794
799
|
|
|
795
800
|
BrowserBot.prototype._getFrameElement = function(win) {
|
|
796
801
|
var frameElement = null;
|
|
@@ -826,7 +831,7 @@ BrowserBot.prototype._getFrameElement = function(win) {
|
|
|
826
831
|
LOG.debug("frameElement.name="+frameElement.name);
|
|
827
832
|
}
|
|
828
833
|
return frameElement;
|
|
829
|
-
}
|
|
834
|
+
};
|
|
830
835
|
|
|
831
836
|
BrowserBot.prototype._getFrameElementByName = function(name, doc, win) {
|
|
832
837
|
var frames;
|
|
@@ -849,7 +854,7 @@ BrowserBot.prototype._getFrameElementByName = function(name, doc, win) {
|
|
|
849
854
|
// DGF weird; we only call this function when we know the doc contains the frame
|
|
850
855
|
LOG.warn("_getFrameElementByName couldn't find a frame or iframe; checking every element for the name " + name);
|
|
851
856
|
return BrowserBot.prototype.locateElementByName(win.name, win.parent.document);
|
|
852
|
-
}
|
|
857
|
+
};
|
|
853
858
|
|
|
854
859
|
|
|
855
860
|
/**
|
|
@@ -908,7 +913,7 @@ BrowserBot.prototype.pollForLoad = function(loadFunction, windowObject, original
|
|
|
908
913
|
BrowserBot.prototype._isSamePage = function(windowObject, originalDocument, originalLocation, originalHref, marker) {
|
|
909
914
|
var currentDocument = windowObject.document;
|
|
910
915
|
var currentLocation = windowObject.location;
|
|
911
|
-
var currentHref = currentLocation.href
|
|
916
|
+
var currentHref = currentLocation.href;
|
|
912
917
|
|
|
913
918
|
var sameDoc = this._isSameDocument(originalDocument, currentDocument);
|
|
914
919
|
|
|
@@ -940,7 +945,7 @@ BrowserBot.prototype._isSamePage = function(windowObject, originalDocument, orig
|
|
|
940
945
|
LOG.debug("_isSamePage: sameHref: " + sameHref);
|
|
941
946
|
LOG.debug("_isSamePage: markedLoc: " + markedLoc);
|
|
942
947
|
|
|
943
|
-
return sameDoc && sameLoc && sameHref && markedLoc
|
|
948
|
+
return sameDoc && sameLoc && sameHref && markedLoc;
|
|
944
949
|
};
|
|
945
950
|
|
|
946
951
|
BrowserBot.prototype._isSameDocument = function(originalDocument, currentDocument) {
|
|
@@ -1078,7 +1083,7 @@ BrowserBot.prototype.getWindowByName = function(windowName, doNotModify) {
|
|
|
1078
1083
|
}
|
|
1079
1084
|
}
|
|
1080
1085
|
if (!targetWindow) {
|
|
1081
|
-
throw new SeleniumError("Window does not exist. If this looks like a Selenium bug, make sure to read http://
|
|
1086
|
+
throw new SeleniumError("Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds.");
|
|
1082
1087
|
}
|
|
1083
1088
|
if (browserVersion.isHTA) {
|
|
1084
1089
|
try {
|
|
@@ -1204,11 +1209,11 @@ BrowserBot.prototype.highlight = function (element, force) {
|
|
|
1204
1209
|
} catch (e) {} // DGF element highlighting is low-priority and possibly dangerous
|
|
1205
1210
|
}
|
|
1206
1211
|
return element;
|
|
1207
|
-
}
|
|
1212
|
+
};
|
|
1208
1213
|
|
|
1209
1214
|
BrowserBot.prototype.setShouldHighlightElement = function (shouldHighlight) {
|
|
1210
1215
|
this.shouldHighlightLocatedElement = shouldHighlight;
|
|
1211
|
-
}
|
|
1216
|
+
};
|
|
1212
1217
|
|
|
1213
1218
|
/*****************************************************************/
|
|
1214
1219
|
/* BROWSER-SPECIFIC FUNCTIONS ONLY AFTER THIS LINE */
|
|
@@ -1254,11 +1259,11 @@ BrowserBot.prototype._registerAllLocatorFunctions = function() {
|
|
|
1254
1259
|
}
|
|
1255
1260
|
return this.locateElementByIdentifier(locator, inDocument, inWindow);
|
|
1256
1261
|
};
|
|
1257
|
-
}
|
|
1262
|
+
};
|
|
1258
1263
|
|
|
1259
1264
|
BrowserBot.prototype.getDocument = function() {
|
|
1260
1265
|
return this.getCurrentWindow().document;
|
|
1261
|
-
}
|
|
1266
|
+
};
|
|
1262
1267
|
|
|
1263
1268
|
BrowserBot.prototype.getTitle = function() {
|
|
1264
1269
|
var t = this.getDocument().title;
|
|
@@ -1266,7 +1271,7 @@ BrowserBot.prototype.getTitle = function() {
|
|
|
1266
1271
|
t = t.trim();
|
|
1267
1272
|
}
|
|
1268
1273
|
return t;
|
|
1269
|
-
}
|
|
1274
|
+
};
|
|
1270
1275
|
|
|
1271
1276
|
BrowserBot.prototype.getCookieByName = function(cookieName, doc) {
|
|
1272
1277
|
if (!doc) doc = this.getDocument();
|
|
@@ -1282,7 +1287,7 @@ BrowserBot.prototype.getCookieByName = function(cookieName, doc) {
|
|
|
1282
1287
|
}
|
|
1283
1288
|
}
|
|
1284
1289
|
return null;
|
|
1285
|
-
}
|
|
1290
|
+
};
|
|
1286
1291
|
|
|
1287
1292
|
BrowserBot.prototype.getAllCookieNames = function(doc) {
|
|
1288
1293
|
if (!doc) doc = this.getDocument();
|
|
@@ -1297,7 +1302,7 @@ BrowserBot.prototype.getAllCookieNames = function(doc) {
|
|
|
1297
1302
|
cookieNames.push(ckName);
|
|
1298
1303
|
}
|
|
1299
1304
|
return cookieNames;
|
|
1300
|
-
}
|
|
1305
|
+
};
|
|
1301
1306
|
|
|
1302
1307
|
BrowserBot.prototype.deleteCookie = function(cookieName, domain, path, doc) {
|
|
1303
1308
|
if (!doc) doc = this.getDocument();
|
|
@@ -1312,13 +1317,13 @@ BrowserBot.prototype.deleteCookie = function(cookieName, domain, path, doc) {
|
|
|
1312
1317
|
cookie += "expires=" + new Date(expireDateInMilliseconds).toGMTString();
|
|
1313
1318
|
LOG.debug("Setting cookie to: " + cookie);
|
|
1314
1319
|
doc.cookie = cookie;
|
|
1315
|
-
}
|
|
1320
|
+
};
|
|
1316
1321
|
|
|
1317
1322
|
/** Try to delete cookie, return false if it didn't work */
|
|
1318
1323
|
BrowserBot.prototype._maybeDeleteCookie = function(cookieName, domain, path, doc) {
|
|
1319
1324
|
this.deleteCookie(cookieName, domain, path, doc);
|
|
1320
1325
|
return (!this.getCookieByName(cookieName, doc));
|
|
1321
|
-
}
|
|
1326
|
+
};
|
|
1322
1327
|
|
|
1323
1328
|
|
|
1324
1329
|
BrowserBot.prototype._recursivelyDeleteCookieDomains = function(cookieName, domain, path, doc) {
|
|
@@ -1333,7 +1338,7 @@ BrowserBot.prototype._recursivelyDeleteCookieDomains = function(cookieName, doma
|
|
|
1333
1338
|
// No more dots; try just not passing in a domain at all
|
|
1334
1339
|
return this._maybeDeleteCookie(cookieName, null, path, doc);
|
|
1335
1340
|
}
|
|
1336
|
-
}
|
|
1341
|
+
};
|
|
1337
1342
|
|
|
1338
1343
|
BrowserBot.prototype._recursivelyDeleteCookie = function(cookieName, domain, path, doc) {
|
|
1339
1344
|
var slashIndex = path.lastIndexOf("/");
|
|
@@ -1346,7 +1351,7 @@ BrowserBot.prototype._recursivelyDeleteCookie = function(cookieName, domain, pat
|
|
|
1346
1351
|
if (deleted) return true;
|
|
1347
1352
|
}
|
|
1348
1353
|
return this._recursivelyDeleteCookieDomains(cookieName, domain, path, doc);
|
|
1349
|
-
}
|
|
1354
|
+
};
|
|
1350
1355
|
|
|
1351
1356
|
BrowserBot.prototype.recursivelyDeleteCookie = function(cookieName, domain, path, win) {
|
|
1352
1357
|
if (!win) win = this.getCurrentWindow();
|
|
@@ -1363,7 +1368,7 @@ BrowserBot.prototype.recursivelyDeleteCookie = function(cookieName, domain, path
|
|
|
1363
1368
|
deleted = this._recursivelyDeleteCookieDomains(cookieName, "." + domain, null, doc);
|
|
1364
1369
|
if (deleted) return;
|
|
1365
1370
|
throw new SeleniumError("Couldn't delete cookie " + cookieName);
|
|
1366
|
-
}
|
|
1371
|
+
};
|
|
1367
1372
|
|
|
1368
1373
|
/*
|
|
1369
1374
|
* Finds an element recursively in frames and nested frames
|
|
@@ -1412,7 +1417,7 @@ BrowserBot.prototype.findElement = function(locator, win) {
|
|
|
1412
1417
|
var element = this.findElementOrNull(locator, win);
|
|
1413
1418
|
if (element == null) throw new SeleniumError("Element " + locator + " not found");
|
|
1414
1419
|
return element;
|
|
1415
|
-
}
|
|
1420
|
+
};
|
|
1416
1421
|
|
|
1417
1422
|
/**
|
|
1418
1423
|
* In non-IE browsers, getElementById() does not search by name. Instead, we
|
|
@@ -1498,6 +1503,7 @@ BrowserBot.prototype.locateElementByDomTraversal = function(domTraversal, docume
|
|
|
1498
1503
|
|
|
1499
1504
|
return element;
|
|
1500
1505
|
};
|
|
1506
|
+
|
|
1501
1507
|
BrowserBot.prototype.locateElementByDomTraversal.prefix = "dom";
|
|
1502
1508
|
|
|
1503
1509
|
/**
|
|
@@ -1517,7 +1523,7 @@ BrowserBot.prototype._namespaceResolver = function(prefix) {
|
|
|
1517
1523
|
} else {
|
|
1518
1524
|
throw new Error("Unknown namespace: " + prefix + ".");
|
|
1519
1525
|
}
|
|
1520
|
-
}
|
|
1526
|
+
};
|
|
1521
1527
|
|
|
1522
1528
|
/**
|
|
1523
1529
|
* Returns the number of xpath results.
|
|
@@ -1541,6 +1547,7 @@ BrowserBot.prototype.locateElementByLinkText = function(linkText, inDocument, in
|
|
|
1541
1547
|
}
|
|
1542
1548
|
return null;
|
|
1543
1549
|
};
|
|
1550
|
+
|
|
1544
1551
|
BrowserBot.prototype.locateElementByLinkText.prefix = "link";
|
|
1545
1552
|
|
|
1546
1553
|
/**
|
|
@@ -1642,7 +1649,7 @@ BrowserBot.prototype.replaceText = function(element, stringValue) {
|
|
|
1642
1649
|
if (getTagName(element) == "body") {
|
|
1643
1650
|
if (element.ownerDocument && element.ownerDocument.designMode) {
|
|
1644
1651
|
var designMode = new String(element.ownerDocument.designMode).toLowerCase();
|
|
1645
|
-
if (designMode
|
|
1652
|
+
if (designMode == "on") {
|
|
1646
1653
|
// this must be a rich text control!
|
|
1647
1654
|
element.innerHTML = actualValue;
|
|
1648
1655
|
}
|
|
@@ -1677,7 +1684,7 @@ BrowserBot.prototype.submit = function(formElement) {
|
|
|
1677
1684
|
// pause for up to 2s while this command runs
|
|
1678
1685
|
var terminationCondition = function () {
|
|
1679
1686
|
return !win[marker];
|
|
1680
|
-
}
|
|
1687
|
+
};
|
|
1681
1688
|
return Selenium.decorateFunctionWithTimeout(terminationCondition, 2000);
|
|
1682
1689
|
} else {
|
|
1683
1690
|
actuallySubmit = formElement.onsubmit();
|
|
@@ -1691,7 +1698,7 @@ BrowserBot.prototype.submit = function(formElement) {
|
|
|
1691
1698
|
} else {
|
|
1692
1699
|
formElement.submit();
|
|
1693
1700
|
}
|
|
1694
|
-
}
|
|
1701
|
+
};
|
|
1695
1702
|
|
|
1696
1703
|
BrowserBot.prototype.clickElement = function(element, clientX, clientY) {
|
|
1697
1704
|
this._fireEventOnElement("click", element, clientX, clientY);
|
|
@@ -1718,7 +1725,7 @@ BrowserBot.prototype._modifyElementTarget = function(element) {
|
|
|
1718
1725
|
}
|
|
1719
1726
|
}
|
|
1720
1727
|
}
|
|
1721
|
-
}
|
|
1728
|
+
};
|
|
1722
1729
|
|
|
1723
1730
|
|
|
1724
1731
|
BrowserBot.prototype._handleClickingImagesInsideLinks = function(targetWindow, element) {
|
|
@@ -1730,7 +1737,7 @@ BrowserBot.prototype._handleClickingImagesInsideLinks = function(targetWindow, e
|
|
|
1730
1737
|
}
|
|
1731
1738
|
itrElement = itrElement.parentNode;
|
|
1732
1739
|
}
|
|
1733
|
-
}
|
|
1740
|
+
};
|
|
1734
1741
|
|
|
1735
1742
|
BrowserBot.prototype._getTargetWindow = function(element) {
|
|
1736
1743
|
var targetWindow = element.ownerDocument.defaultView;
|
|
@@ -1738,7 +1745,7 @@ BrowserBot.prototype._getTargetWindow = function(element) {
|
|
|
1738
1745
|
targetWindow = this._getFrameFromGlobal(element.target);
|
|
1739
1746
|
}
|
|
1740
1747
|
return targetWindow;
|
|
1741
|
-
}
|
|
1748
|
+
};
|
|
1742
1749
|
|
|
1743
1750
|
BrowserBot.prototype._getFrameFromGlobal = function(target) {
|
|
1744
1751
|
|
|
@@ -1760,7 +1767,7 @@ BrowserBot.prototype._getFrameFromGlobal = function(target) {
|
|
|
1760
1767
|
var win = this.getWindowByName(target);
|
|
1761
1768
|
if (win) return win;
|
|
1762
1769
|
return this.getCurrentWindow().open('', target);
|
|
1763
|
-
}
|
|
1770
|
+
};
|
|
1764
1771
|
|
|
1765
1772
|
|
|
1766
1773
|
BrowserBot.prototype.bodyText = function() {
|
|
@@ -1810,7 +1817,7 @@ BrowserBot.prototype.getAllLinks = function() {
|
|
|
1810
1817
|
|
|
1811
1818
|
function isDefined(value) {
|
|
1812
1819
|
return typeof(value) != undefined;
|
|
1813
|
-
}
|
|
1820
|
+
};
|
|
1814
1821
|
|
|
1815
1822
|
BrowserBot.prototype.goBack = function() {
|
|
1816
1823
|
this.getCurrentWindow().history.back();
|
|
@@ -1908,10 +1915,10 @@ BrowserBot.prototype.selectElements = function(filterExpr, elements, defaultFilt
|
|
|
1908
1915
|
BrowserBot.prototype.locateElementByClass = function(locator, document) {
|
|
1909
1916
|
return elementFindFirstMatchingChild(document,
|
|
1910
1917
|
function(element) {
|
|
1911
|
-
return element.className == locator
|
|
1918
|
+
return element.className == locator;
|
|
1912
1919
|
}
|
|
1913
1920
|
);
|
|
1914
|
-
}
|
|
1921
|
+
};
|
|
1915
1922
|
|
|
1916
1923
|
/**
|
|
1917
1924
|
* Find an element by alt
|
|
@@ -1919,10 +1926,10 @@ BrowserBot.prototype.locateElementByClass = function(locator, document) {
|
|
|
1919
1926
|
BrowserBot.prototype.locateElementByAlt = function(locator, document) {
|
|
1920
1927
|
return elementFindFirstMatchingChild(document,
|
|
1921
1928
|
function(element) {
|
|
1922
|
-
return element.alt == locator
|
|
1929
|
+
return element.alt == locator;
|
|
1923
1930
|
}
|
|
1924
1931
|
);
|
|
1925
|
-
}
|
|
1932
|
+
};
|
|
1926
1933
|
|
|
1927
1934
|
/**
|
|
1928
1935
|
* Find an element by css selector
|
|
@@ -1932,7 +1939,7 @@ BrowserBot.prototype.locateElementByCss = function(locator, document) {
|
|
|
1932
1939
|
if (elements.length != 0)
|
|
1933
1940
|
return elements[0];
|
|
1934
1941
|
return null;
|
|
1935
|
-
}
|
|
1942
|
+
};
|
|
1936
1943
|
|
|
1937
1944
|
/**
|
|
1938
1945
|
* This function is responsible for mapping a UI specifier string to an element
|
|
@@ -1964,7 +1971,7 @@ BrowserBot.prototype.locateElementByUIElement = function(locator, inDocument) {
|
|
|
1964
1971
|
}
|
|
1965
1972
|
|
|
1966
1973
|
return locatedElement;
|
|
1967
|
-
}
|
|
1974
|
+
};
|
|
1968
1975
|
|
|
1969
1976
|
BrowserBot.prototype.locateElementByUIElement.prefix = 'ui';
|
|
1970
1977
|
|
|
@@ -2003,12 +2010,12 @@ BrowserBot.prototype.locateElementByUIElement.is_fuzzy_match = function(node, ta
|
|
|
2003
2010
|
|
|
2004
2011
|
function MozillaBrowserBot(frame) {
|
|
2005
2012
|
BrowserBot.call(this, frame);
|
|
2006
|
-
}
|
|
2013
|
+
};
|
|
2007
2014
|
objectExtend(MozillaBrowserBot.prototype, BrowserBot.prototype);
|
|
2008
2015
|
|
|
2009
2016
|
function KonquerorBrowserBot(frame) {
|
|
2010
2017
|
BrowserBot.call(this, frame);
|
|
2011
|
-
}
|
|
2018
|
+
};
|
|
2012
2019
|
objectExtend(KonquerorBrowserBot.prototype, BrowserBot.prototype);
|
|
2013
2020
|
|
|
2014
2021
|
KonquerorBrowserBot.prototype.setIFrameLocation = function(iframe, location) {
|
|
@@ -2027,7 +2034,7 @@ KonquerorBrowserBot.prototype.setOpenLocation = function(win, loc) {
|
|
|
2027
2034
|
if ("about:blank" != win.location.href) {
|
|
2028
2035
|
var startLoc = parseUrl(win.location.href);
|
|
2029
2036
|
startLoc.hash = null;
|
|
2030
|
-
|
|
2037
|
+
startUrl = reassembleLocation(startLoc);
|
|
2031
2038
|
}
|
|
2032
2039
|
LOG.debug("startUrl="+startUrl);
|
|
2033
2040
|
LOG.debug("win.location.href="+win.location.href);
|
|
@@ -2051,7 +2058,7 @@ KonquerorBrowserBot.prototype._isSameDocument = function(originalDocument, curre
|
|
|
2051
2058
|
// originalDocument and currentDocument are different objects
|
|
2052
2059
|
// while their location are same.
|
|
2053
2060
|
if (originalDocument) {
|
|
2054
|
-
return originalDocument.location == currentDocument.location
|
|
2061
|
+
return originalDocument.location == currentDocument.location;
|
|
2055
2062
|
} else {
|
|
2056
2063
|
return originalDocument === currentDocument;
|
|
2057
2064
|
}
|
|
@@ -2068,7 +2075,7 @@ SafariBrowserBot.prototype.setOpenLocation = KonquerorBrowserBot.prototype.setOp
|
|
|
2068
2075
|
|
|
2069
2076
|
function OperaBrowserBot(frame) {
|
|
2070
2077
|
BrowserBot.call(this, frame);
|
|
2071
|
-
}
|
|
2078
|
+
};
|
|
2072
2079
|
objectExtend(OperaBrowserBot.prototype, BrowserBot.prototype);
|
|
2073
2080
|
OperaBrowserBot.prototype.setIFrameLocation = function(iframe, location) {
|
|
2074
2081
|
if (iframe.src == location) {
|
|
@@ -2076,11 +2083,11 @@ OperaBrowserBot.prototype.setIFrameLocation = function(iframe, location) {
|
|
|
2076
2083
|
} else {
|
|
2077
2084
|
iframe.src = location;
|
|
2078
2085
|
}
|
|
2079
|
-
}
|
|
2086
|
+
};
|
|
2080
2087
|
|
|
2081
2088
|
function IEBrowserBot(frame) {
|
|
2082
2089
|
BrowserBot.call(this, frame);
|
|
2083
|
-
}
|
|
2090
|
+
};
|
|
2084
2091
|
objectExtend(IEBrowserBot.prototype, BrowserBot.prototype);
|
|
2085
2092
|
|
|
2086
2093
|
IEBrowserBot.prototype._handleClosedSubFrame = function(testWindow, doNotModify) {
|
|
@@ -2165,9 +2172,10 @@ IEBrowserBot.prototype.pollForLoad = function(loadFunction, windowObject, origin
|
|
|
2165
2172
|
LOG.debug("IEBrowserBot.pollForLoad: " + marker);
|
|
2166
2173
|
if (!this.permDeniedCount[marker]) this.permDeniedCount[marker] = 0;
|
|
2167
2174
|
BrowserBot.prototype.pollForLoad.call(this, loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
|
|
2175
|
+
var self;
|
|
2168
2176
|
if (this.pageLoadError) {
|
|
2169
2177
|
if (this.pageUnloading) {
|
|
2170
|
-
|
|
2178
|
+
self = this;
|
|
2171
2179
|
LOG.debug("pollForLoad UNLOADING (" + marker + "): caught exception while firing events on unloading page: " + this.pageLoadError.message);
|
|
2172
2180
|
this.reschedulePoller(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
|
|
2173
2181
|
this.pageLoadError = null;
|
|
@@ -2193,7 +2201,7 @@ IEBrowserBot.prototype.pollForLoad = function(loadFunction, windowObject, origin
|
|
|
2193
2201
|
}
|
|
2194
2202
|
}
|
|
2195
2203
|
|
|
2196
|
-
|
|
2204
|
+
self = this;
|
|
2197
2205
|
LOG.debug("pollForLoad (" + marker + "): " + this.pageLoadError.message + " (" + this.permDeniedCount[marker] + "), waiting to see if it goes away");
|
|
2198
2206
|
this.reschedulePoller(loadFunction, windowObject, originalDocument, originalLocation, originalHref, marker);
|
|
2199
2207
|
this.pageLoadError = null;
|
|
@@ -2391,7 +2399,7 @@ SafariBrowserBot.prototype.refresh = function() {
|
|
|
2391
2399
|
win.location.hash = "";
|
|
2392
2400
|
var actuallyReload = function() {
|
|
2393
2401
|
win.location.reload(true);
|
|
2394
|
-
}
|
|
2402
|
+
};
|
|
2395
2403
|
window.setTimeout(actuallyReload, 1);
|
|
2396
2404
|
} else {
|
|
2397
2405
|
win.location.reload(true);
|