UNPKG

1.49 kBMarkdownView Raw
1`async`/`await` and the Web Driver Control Flow
2===============================================
3
4The Web Driver Control Flow is used to synchronize your commands so they reach
5the browser in the correct order (see [control-flow.md](
6../../docs/control-flow.md) for details). In the future, the control flow is
7being removed, however (see [github issue](
8https://github.com/SeleniumHQ/selenium/issues/2969) for details). Instead of
9the control flow, you can synchronize your commands with promise chaining or the
10upcomming ES7 feature `async`/`await`. However, you cannot use a mix of
11`async`/`await` and the control flow: `async`/`await` causes the control flow to
12become unreliable (see [github issue](
13https://github.com/SeleniumHQ/selenium/issues/3037)). So if you `async`/`await`
14anywhere in a spec, you should use `await` or promise chaining to handle all
15asynchronous activity (e.g. any command interacting with the browser) for the
16rest of that test.
17
18In the near future there will be an option to disable the Web Driver control
19flow entierly (see https://github.com/angular/protractor/issues/3691). If you
20are using `async`/`await`, it is highly recommended that you disable the Web
21Driver control flow.
22
23
24Compiling `async`/`await` syntax
25================================
26
27`async`/`await` syntax is currently accessible via typescript if you compile
28using `tsc -t ES2015 <files>`. You can also compile it using [regenerator](
29 https://github.com/facebook/regenerator).