Path: blob/main/files/en-us/web/webdriver/errors/javascripterror/index.md
6529 views
------{{QuickLinksWithSubpages("/en-US/docs/Web/WebDriver/Errors")}}
The JavaScript error is a WebDriver error that occurs when a script the supplied by the user fails to execute.
The underlying cause of the execution error is often supplied in the error message, along with a stacktrace provided by the JavaScript engine in the browser.
Example
Consider the following injected script which tries to use an undefined variable. In JavaScript this normally causes a ReferenceError to be thrown. WebDriver catches this error and serializes it as a JavaScript error:
Output:
See also
Associated commands: