An Automated Test Framework test reported Failure, and its Test Result has a Step Result with the following summary:

This step failed because a client-side Javascript error was detected on the page being tested. See the logs and screenshots on the test result for details

In the event of a browser Javascript error, the Automated Test Framework fails the test on the step that is being executed when it occurred.

The purpose of this error message is to help developers and testers find customization issues on their instance that occurred while executing that test step.

With the ServiceNow platform, even though Client Scripts can fail silently on Javascript errors while executing procedures, the error may still impact data and the procedure being executed, so the Automated Test Framework considers these errors as a validation failure.

Steps to Reproduce


  1. Run an Automated Test Framework test that interacts with a form.

  2. Check the Test Results for this test, for a Step Result with the following Summary:
    This step failed because a client-side JavaScript error was detected on the page being tested. See the logs and screenshots on the test result for details.

This Step Result appears only on a step that interacts with the UI.



To identify and resolve these script errors:
  1. Open the developer tools browser console on the Client Test Runner page.
  2. Navigate to Automated Test Framework > Tests and run the test, so that it is picked up by the same Client Test Runner.
  3. After the test completes, review the browser window's console for script errors.
  4. If you can see the error, then try to identify and troubleshoot the problematic script, which may be on any of the following base system tables:
    • Client Script
    • UI Action
    • UI Macro (HTML script)
    • UI Page (HTML script)
    • UI Policy
    • UI Script
    • Tables that extend the above base system tables
  5. Review the script for errors and once it has been fixed, run your test again.

To track down what introduced the script error, you can review that script's version history from the Versions related list of that script record.

  • If you've customized a base system script, it's possible that during an upgrade of your instance, a base system version of that script - that had been changed in the upgraded ServiceNow release - was skipped, and that change needed to be propagated to the customization.

Examples of client JavaScript errors

Client Script error

When a client script causes an error, the browser console displays an error similar to the following example:
A script has encountered an error in render events
TypeError: Cannot read property 'id' of undefined
Script ends. Continuing happily
[00:00:00.002] onLoad Modify Comments Label
In this example, the client script Modify Comments Label caused the error.

Other client script errors

Any other type of script error reports directly to the browser console without any formatting upon occurrence.

TypeError: callbacks[id] is undefined

Script resource links

In some cases the console error provides a link to the script resource file. Following this link may give context to which script had executed it.


Uncaught ReferenceError: myobj is not defined
    at incident.do?sys_id=12345678901234567890123456789012
(anonymous) @ incident.do?sys_id=12345678901234567890123456789012  <---- LINK

Access to scripts

While identifying problematic scripts, be sure to have necessary permissions and check relevant domains if they're configured.

Related Problem: PRB1037062

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-03-13 11:03:20