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