question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Safari: Uncaught object "[object Object]" was thrown. Throw Error instead.

See original GitHub issue

What is your Test Scenario?

This error occurs on a number of tests… but the easiest one is navigating to a url that redirects.

What is the Current behavior?

Similar to #6593, I’m getting an uncaught object error in Safari. I’m suppressing JS errors and uncaught errors… but my tests are still failing.

What is the Expected behavior?

I can navigate to the desired page, and no error is thrown once the page loads

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):
Your complete test code (or attach your test files):
 import { Selector } from 'testcafe';

fixture('Navigate to petition page, non-promoteable petition').page('https://www.change.org/');

test('Ensure promotion page does not show', async t => {
  await t
    .navigateTo('/p/united-nations-send-matt-damon-to-mars-to-retrieve-opportunity/sponsors/new')
    .expect(Selector('[data-testid="signform-submit-button"]').visible)
    .ok();
});
Your complete configuration file (if any):
{
  "src": "./tests/**/*.js",
  "clientScripts":[
    {
      "module":"axe-core/axe.min.js"
    }
  ],

  "assertionTimeout": 15000,
  "ajaxRequestTimeout": 40000,
  "pageLoadTimeout": 30000,
  "selectorTimeout": 15000,

  "disableMultipleWindows": false,

  "quarantineMode": false,
  "skipJsErrors": true,

  "disablePageCaching": true,

  "reporter": [
    {
      "name": "xunit",
      "output": "artifacts/test-results/results.xml"
    },
    {
      "name": "spec"
    }
  ],

  "screenshots": {
    "fullPage": true,
    "takeOnFails": true,
    "pathPattern": "${TEST_ID}/${RUN_ID}_${FILE_INDEX}.png",
    "path": "artifacts/screenshots",
    "thumbnails": false
  }
}
Your complete test report:
   1) Uncaught object "[object Object]" was thrown. Throw Error instead.

      Browser: Safari 15.0 / macOS 10.15.7
      Screenshot: /Users/rcooper/work/github.com/change/regression-qaa/artifacts/screenshots/test-1/_errors/1.png

Screenshots:
https://user-images.githubusercontent.com/37812673/137813141-419be9a1-af3c-4f8e-8bfa-0b7be28b96e8.png

Steps to Reproduce:

  1. Go to my website …
  2. Execute this command…
  3. See the error…

Your Environment details:

  • testcafe version: 1.16.1
  • node.js version: 14.16.1
  • command-line arguments: testcafe safari -u
  • browser name and version: Safari 15.0
  • platform and version: macOS 10.15.7
  • other:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Farfurixcommented, Nov 24, 2021

@danieltroger

Hello,

Thank you for your research, we’ll review @rob4629’s PR.

1reaction
danieltrogercommented, Nov 23, 2021

I tried to prepare a pull request but I’m failing at creating a test case because it’s impossible to install IE11 and I’m running macOS: Error: Cannot find the browser. "ie" is neither a known browser alias, nor a path to an executable file.

But I made a patch instead that you can use to fix the error locally while we’re waiting for testcafe @rob4629:

testcafe_fix_6624.patch.zip

Put this into your package.json:

"resolutions": {
    "testcafe": "patch:testcafe@latest#./patches/testcafe_fix_6624.patch"
  }

unzip the file and put it into a folder called patches relative to your package.json and run yarn install You might have to replace latest in the resolution with whatever version you have pinned of testcafe.

Generated with https://yarnpkg.com/cli/patch and works with yarn 3.1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the difference between `throw new Error` and ` ...
The Error constructor is used to create an error object. Error objects are thrown when runtime errors occur.
Read more >
throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. Execution of the current ... You can specify an object when you throw an exception.
Read more >
The source code
In all cases, the error will always be thrown at the end so that * execution will halt. ... The {@link #raise} method...
Read more >
228909 - custom Errors are reported as "Uncaught [object ...
Looks like when an error is thrown which inherits from Error, when the error is reported to window.onerror or console or developer tools, ......
Read more >
Safari Technology Preview Release Notes
toMatrix() to throw an exception if its length is not compatible with a px unit ... Enabled constructible and adoptable CSSStyleSheet objects (255067@main) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found