You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/faq.md
+3-6
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,10 @@ How do I deal with my log-in page?
34
34
35
35
If your app needs log-in, there are a couple ways to deal with it. If your login
36
36
page is not written with Angular, you'll need to interact with it via
37
-
unwrapped webdriver, which can be accessed like `browser.driver.get()`.
37
+
unwrapped webdriver, which can be accessed like `browser.driver.get()`. You can also use
38
+
`browser.ignoreSynchronization` as explained [here](/docs/timeouts.md#how-to-disable-waiting-for-angular).
38
39
39
-
You can put your log-in code into an `onPrepare` function, which will be run
40
+
Another option is to put your log-in code into an `onPrepare` function, which will be run
40
41
once before any of your tests. See this example ([withLoginConf.js](https://github.com/angular/protractor/blob/master/spec/withLoginConf.js))
41
42
42
43
Which browsers are supported?
@@ -165,10 +166,6 @@ var remote = require('selenium-webdriver/remote');
The most likely reason is that you are not running the test in debug mode. To do this you run: `protractor debug` followed by the path to your protractor configuration file.
171
-
172
169
I get an error: Page reload detected during async script. What does this mean?
Copy file name to clipboardExpand all lines: docs/timeouts.md
+22-19
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Because WebDriver tests are asynchronous and involve many components, there are
6
6
Timeouts from Protractor
7
7
------------------------
8
8
9
-
**Waiting for Page to Load**
9
+
### Waiting for Page to Load
10
10
11
11
When navigating to a new page using `browser.get`, Protractor waits for the page to
12
12
be loaded and the new URL to appear before continuing.
@@ -17,48 +17,51 @@ be loaded and the new URL to appear before continuing.
17
17
18
18
- How to change: To change globally, add `getPageTimeout: timeout_in_millis` to your Protractor configuration file. For an individual call to `get`, pass an additional parameter: `browser.get(address, timeout_in_millis)`
19
19
20
-
**Waiting for Page Synchronization**
20
+
### Waiting for Angular
21
21
22
-
Before performing any action, Protractor asks Angular to wait until the page is synchronized. This means that all timeouts and http requests are finished. If your application continuously polls $timeout or $http, it will
23
-
never be registered as completely loaded. You should use the
24
-
$interval service ([interval.js](https://github.com/angular/angular.js/blob/master/src/ng/interval.js)) for anything that polls continuously (introduced in Angular 1.2rc3).
22
+
Before performing any action, Protractor waits until there are no pending asynchronous tasks in your Angular application. This means that all timeouts and http requests are finished. If your application continuously polls $timeout or $http, Protractor will wait indefinitely and time out. You should use the
23
+
[$interval](https://github.com/angular/angular.js/blob/master/src/ng/interval.js) for anything that polls continuously (introduced in Angular 1.2rc3).
25
24
26
-
- Looks like: an error in your test results - `Timed out waiting for Protractor to synchronize with the page after 11 seconds.`
25
+
You can also disable waiting for angular, [see below](#how-to-disable-waiting-for-angular).
26
+
27
+
- Looks like: an error in your test results - `Timed out waiting for asynchronous Angular tasks to finish after 11 seconds.`
27
28
28
29
- Default timeout: 11 seconds
29
30
30
31
- How to change: Add `allScriptsTimeout: timeout_in_millis` to your Protractor configuration file.
31
32
32
-
**Waiting for Angular**
33
+
### Waiting for Angular on Page Load
33
34
34
-
Protractor only works with Angular applications, so it waits for the `angular` variable to be present when it is loading a new page.
35
+
Protractor waits for the `angular` variable to be present when loading a new page.
35
36
36
37
- Looks like: an error in your test results - `Angular could not be found on the page: retries looking for angular exceeded`
37
38
38
39
- Default timeout: 10 seconds
39
40
40
41
- How to change: To change globally, add `getPageTimeout: timeout_in_millis` to your Protractor configuration file. For an individual call to `get`, pass an additional parameter: `browser.get(address, timeout_in_millis)`
41
42
42
-
_*How to disable waiting for Angular*_
43
+
### _How to disable waiting for Angular_
43
44
44
45
If you need to navigate to a page which does not use Angular, you can turn off waiting for Angular by setting
45
46
`browser.ignoreSynchronization = true`. For example:
46
47
47
48
```js
48
-
browser.get('page-containing-angular');
49
-
navigateToVanillaPage.click();
50
49
browser.ignoreSynchronization=true;
51
-
otherButton.click();
52
-
navigateToAngularPage.click();
50
+
browser.get('/non-angular-login-page.html');
51
+
52
+
element(by.id('username')).sendKeys('Jane');
53
+
element(by.id('password')).sendKeys('1234');
54
+
element(by.id('clickme')).click();
55
+
53
56
browser.ignoreSynchronization=false;
57
+
browser.get('/page-containing-angular.html');
54
58
```
55
59
56
60
57
-
58
61
Timeouts from WebDriver
59
62
-----------------------
60
63
61
-
**Asynchronous Script Timeout**
64
+
### Asynchronous Script Timeout
62
65
63
66
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.
64
67
@@ -72,7 +75,7 @@ Sets the amount of time to wait for an asynchronous script to finish execution b
72
75
Timeouts from Jasmine
73
76
---------------------
74
77
75
-
**Spec Timeout**
78
+
### Spec Timeout
76
79
77
80
If a spec (an 'it' block) takes longer than the Jasmine timeout for any reason, it will fail.
78
81
@@ -87,7 +90,7 @@ Timeouts from Sauce Labs
87
90
------------------------
88
91
If you are using Sauce Labs, there are a couple additional ways your test can time out. See [Sauce Labs Timeouts Documentation](https://docs.saucelabs.com/reference/test-configuration/#timeouts) for more information.
89
92
90
-
**Maximum Test Duration**
93
+
### Maximum Test Duration
91
94
92
95
Sauce Labs limits the maximum total duration for a test.
93
96
@@ -97,7 +100,7 @@ Sauce Labs limits the maximum total duration for a test.
97
100
98
101
- How to change: Edit the "max-duration" key in the capabilities object.
99
102
100
-
**Command Timeout**
103
+
### Command Timeout
101
104
102
105
As a safety measure to prevent Selenium crashes from making your tests run indefinitely, Sauce limits how long Selenium can take to run a command in browsers. This is set to 300 seconds by default.
103
106
@@ -107,7 +110,7 @@ As a safety measure to prevent Selenium crashes from making your tests run indef
107
110
108
111
- How to change: Edit the "command-timeout" key in the capabilities object.
109
112
110
-
**Idle Timeout**
113
+
### Idle Timeout
111
114
112
115
As a safety measure to prevent tests from running too long after something has gone wrong, Sauce limits how long a browser can wait for a test to send a new command. This is set to 90 seconds by default. You can adjust this limit on a per-job basis.
0 commit comments