2020-12-30 18:04:51 -08:00
|
|
|
<!-- THIS FILE IS NOW GENERATED -->
|
|
|
|
|
2020-01-23 15:54:09 -08:00
|
|
|
# Troubleshooting
|
|
|
|
|
|
|
|
<!-- GEN:toc -->
|
2020-12-14 08:16:36 -08:00
|
|
|
- [Browser dependencies](#browser-dependencies)
|
2020-03-21 17:58:08 -07:00
|
|
|
- [Code transpilation issues](#code-transpilation-issues)
|
2020-07-27 13:27:41 -04:00
|
|
|
- [Node.js requirements](#nodejs-requirements)
|
2020-03-21 17:58:08 -07:00
|
|
|
* [ReferenceError: URL is not defined](#referenceerror-url-is-not-defined)
|
2020-01-23 15:54:09 -08:00
|
|
|
<!-- GEN:stop -->
|
2020-03-21 17:58:08 -07:00
|
|
|
|
2020-12-14 08:16:36 -08:00
|
|
|
## Browser dependencies
|
2020-01-23 15:54:09 -08:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Playwright does self-inspection every time it runs to make sure the browsers can
|
|
|
|
be launched successfully. If there are missing dependencies, playwright will
|
|
|
|
print instructions to acquire them.
|
2020-01-23 15:54:09 -08:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
We also provide [Ubuntu 18.04 dockerfile](docker/Dockerfile.bionic) and
|
|
|
|
[Ubuntu 20.04 dockerfile](docker/Dockerfile.focal) with the list of Debian
|
|
|
|
dependencies.
|
2020-03-21 17:58:08 -07:00
|
|
|
|
|
|
|
## Code transpilation issues
|
2020-01-23 15:54:09 -08:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
If you are using a JavaScript transpiler like babel or TypeScript, calling
|
|
|
|
`evaluate()` with an async function might not work. This is because while
|
|
|
|
`playwright` uses `Function.prototype.toString()` to serialize functions while
|
|
|
|
transpilers could be changing the output code in such a way it's incompatible
|
|
|
|
with `playwright`.
|
2020-01-23 15:54:09 -08:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Some workarounds to this problem would be to instruct the transpiler not to mess
|
|
|
|
up with the code, for example, configure TypeScript to use latest ECMAScript
|
|
|
|
version (`"target": "es2018"`). Another workaround could be using string
|
|
|
|
templates instead of functions:
|
2020-01-23 15:54:09 -08:00
|
|
|
|
|
|
|
```js
|
|
|
|
await page.evaluate(`(async() => {
|
|
|
|
console.log('1');
|
|
|
|
})()`);
|
|
|
|
```
|
|
|
|
|
2020-07-27 13:27:41 -04:00
|
|
|
## Node.js requirements
|
2020-03-21 17:58:08 -07:00
|
|
|
|
|
|
|
### ReferenceError: URL is not defined
|
2020-01-24 09:04:54 -08:00
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Playwright requires Node.js 10 or higher. Node.js 8 is not supported, and will
|
|
|
|
cause you to receive this error.
|
2020-01-24 09:04:54 -08:00
|
|
|
|
2020-01-23 15:54:09 -08:00
|
|
|
# Please file an issue
|
|
|
|
|
2020-12-30 18:04:51 -08:00
|
|
|
Playwright is a new project, and we are watching the issues very closely. As we
|
|
|
|
solve common issues, this document will grow to include the common answers.
|
|
|
|
[Playwright]: api.md#class-playwright "Playwright"
|
|
|
|
[Browser]: api.md#class-browser "Browser"
|
|
|
|
[BrowserContext]: api.md#class-browsercontext "BrowserContext"
|
|
|
|
[Page]: api.md#class-page "Page"
|
|
|
|
[Frame]: api.md#class-frame "Frame"
|
|
|
|
[ElementHandle]: api.md#class-elementhandle "ElementHandle"
|
|
|
|
[JSHandle]: api.md#class-jshandle "JSHandle"
|
|
|
|
[ConsoleMessage]: api.md#class-consolemessage "ConsoleMessage"
|
|
|
|
[Dialog]: api.md#class-dialog "Dialog"
|
|
|
|
[Download]: api.md#class-download "Download"
|
|
|
|
[Video]: api.md#class-video "Video"
|
|
|
|
[FileChooser]: api.md#class-filechooser "FileChooser"
|
|
|
|
[Keyboard]: api.md#class-keyboard "Keyboard"
|
|
|
|
[Mouse]: api.md#class-mouse "Mouse"
|
|
|
|
[Touchscreen]: api.md#class-touchscreen "Touchscreen"
|
|
|
|
[Request]: api.md#class-request "Request"
|
|
|
|
[Response]: api.md#class-response "Response"
|
|
|
|
[Selectors]: api.md#class-selectors "Selectors"
|
|
|
|
[Route]: api.md#class-route "Route"
|
|
|
|
[WebSocket]: api.md#class-websocket "WebSocket"
|
|
|
|
[TimeoutError]: api.md#class-timeouterror "TimeoutError"
|
|
|
|
[Accessibility]: api.md#class-accessibility "Accessibility"
|
|
|
|
[Worker]: api.md#class-worker "Worker"
|
|
|
|
[BrowserServer]: api.md#class-browserserver "BrowserServer"
|
|
|
|
[BrowserType]: api.md#class-browsertype "BrowserType"
|
|
|
|
[Logger]: api.md#class-logger "Logger"
|
|
|
|
[ChromiumBrowser]: api.md#class-chromiumbrowser "ChromiumBrowser"
|
|
|
|
[ChromiumBrowserContext]: api.md#class-chromiumbrowsercontext "ChromiumBrowserContext"
|
|
|
|
[ChromiumCoverage]: api.md#class-chromiumcoverage "ChromiumCoverage"
|
|
|
|
[CDPSession]: api.md#class-cdpsession "CDPSession"
|
|
|
|
[FirefoxBrowser]: api.md#class-firefoxbrowser "FirefoxBrowser"
|
|
|
|
[WebKitBrowser]: api.md#class-webkitbrowser "WebKitBrowser"
|
|
|
|
[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"
|
|
|
|
[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"
|
|
|
|
[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"
|
|
|
|
[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"
|
|
|
|
[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"
|
|
|
|
[EvaluationArgument]: #evaluationargument "Evaluation Argument"
|
|
|
|
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"
|
|
|
|
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
|
|
|
|
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
|
|
|
|
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"
|
|
|
|
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
|
|
|
|
[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"
|
|
|
|
[URL]: https://nodejs.org/api/url.html "URL"
|
|
|
|
[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"
|
|
|
|
[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"
|
|
|
|
[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"
|
|
|
|
[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"
|
|
|
|
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"
|
|
|
|
[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"
|
|
|
|
[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"
|
|
|
|
[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"
|
|
|
|
[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"
|
|
|
|
[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"
|
|
|
|
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"
|
|
|
|
[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"
|