-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_extention.js
58 lines (53 loc) · 1.87 KB
/
user_extention.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Selenium.prototype.doWaitAndClick = function(locator, timeout) {
/**
* First, Wait to find the element (specified by locator).
* Finally, clicks on it (a link, button, checkbox or radio button)
*
* @param locator an <a href="#locators">element locator</a>
* @param timeout Optional - a timeout in milliseconds, after which the action will return with an error.
* If this value is not specified, the default Selenium
* timeout will be used. See the setTimeout() command.
*/
if (! timeout) {
timeout = this.defaultTimeout;
}
return Selenium.decorateFunctionWithTimeout(function() {
find = selenium.isElementPresent(locator);
if (find) {
LOG.info(location + ' has been found...');
selenium.doClick(locator);
LOG.info(location + ' has been clicked...');
}
return find;
}, timeout);
}
Selenium.prototype.doWaitAndType = function(locator, text) {
/**
* First, Wait to find the element (specified by locator).
* Finally, type the text inside the element found
*
* @param locator an <a href="#locators">element locator</a>
* @param text text to type in the element identified by locator.
*/
return Selenium.decorateFunctionWithTimeout(function() {
find = selenium.isElementPresent(locator);
if (find) {
LOG.info(location + ' has been found...');
selenium.doType(locator, text);
LOG.info(text + ' has been typed...');
}
return find;
}, this.defaultTimeout);
}
// Selenium.prototype.doWaitingReqs = function(timeout) {
// if (! timeout) {
// timeout = this.defaultTimeout;
// }
// return Selenium.decorateFunctionWithTimeout(function() {
// var testWindow = selenium.browserbot.getCurrentWindow();
// if (testWindow.jQuery.active == 0) {
// return true;
// }
// return false;
// }, timeout);
// }