Safari: Uncaught object "[object Object]" was thrown. Throw Error instead.
See original GitHub issueWhat 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:
- Go to my website …
- Execute this command…
- 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:
- Created 2 years ago
- Comments:15 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@danieltroger
Hello,
Thank you for your research, we’ll review @rob4629’s PR.
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:unzip the file and put it into a folder called
patchesrelative to your package.json and runyarn installYou might have to replacelatestin the resolution with whatever version you have pinned oftestcafe.Generated with https://yarnpkg.com/cli/patch and works with yarn 3.1.0