I have been using testcafe for the last four months without any issue. It has been a smooth transition from selenium! But in the last day I'm running into a new issue that I cannot seem to fix. The most irritating part is that the error does not happen on all chrome instances. It seems to only affect the two machines I have to run the test suites. No changes have been made to the machine or version or testcafe - so I'm wondering what else to try.
When opening the log in dialog or log in page for our app - a call is made to recaptcha. A subsequent webworker call is made.
Visiting the log in page or opening the log in dialog in chrome works just fine. When using testcafe, there is a console error for the webworker call: See below for full error.
No error and the webworker call is made
You can see this error by visiting https://migraine.com/member-login/
import { t } from 'testcafe';
fixture`Recaptcha error`
test('Go to login', async t => {
await t.navigateTo('https://migraine.com/member-login');
await t.debug();
})
Your complete test report:
VM818 hammerhead.js:12 Uncaught DOMException: Failed to construct 'Worker': Script at 'https://www.google.com/recaptcha/api2/webworker.js?hl=en&v=NTa-8tBgsAw62CYTJPliVdrV' cannot be accessed from origin 'http://192.168.1.243:53482'.
at new Worker (http://192.168.1.243:53482/hammerhead.js:12:12048)
at b3.<anonymous> (http://192.168.1.243:53482/yKj9vwo6f*vnYx2GOLE!s!utf-8/https://www.gstatic.com/recaptcha/releases/NTa-8tBgsAw62CYTJPliVdrV/recaptcha__en.js:107:362)
at new b3 (http://192.168.1.243:53482/yKj9vwo6f*vnYx2GOLE!s!utf-8/https://www.gstatic.com/recaptcha/releases/NTa-8tBgsAw62CYTJPliVdrV/recaptcha__en.js:408:252)
at Er.<anonymous> (http://192.168.1.243:53482/yKj9vwo6f*vnYx2GOLE!s!utf-8/https://www.gstatic.com/recaptcha/releases/NTa-8tBgsAw62CYTJPliVdrV/recaptcha__en.js:287:235)
at new Er (http://192.168.1.243:53482/yKj9vwo6f*vnYx2GOLE!s!utf-8/https://www.gstatic.com/recaptcha/releases/NTa-8tBgsAw62CYTJPliVdrV/recaptcha__en.js:393:179)
at Object.init (http://192.168.1.243:53482/yKj9vwo6f*vnYx2GOLE!s!utf-8/https://www.gstatic.com/recaptcha/releases/NTa-8tBgsAw62CYTJPliVdrV/recaptcha__en.js:508:2457)
at http://192.168.1.243:53482/yKj9vwo6f*vnYx2GOLE!i/https://www.google.com/recaptcha/api2/anchor?ar=1&k=6LfD7o8UAAAAAGDI5DRhS6Jrvl0hFxmLh7es1GG0&co=aHR0cHM6Ly9taWdyYWluZS5jb206NDQz&hl=en&v=NTa-8tBgsAw62CYTJPliVdrV&size=invisible&cb=vvrbtdopncld:189:29
Worker @ VM818 hammerhead.js:12
(anonymous) @ VM828 recaptcha__en.js:107
b3 @ VM828 recaptcha__en.js:408
(anonymous) @ VM828 recaptcha__en.js:287
Er @ VM828 recaptcha__en.js:393
(anonymous) @ VM828 recaptcha__en.js:508
(anonymous) @ anchor?ar=1&k=6LfD7o8UAAAAAGDI5DRhS6Jrvl0hFxmLh7es1GG0&co=aHR0cHM6Ly9taWdyYWluZS5jb206NDQz&hl=en&v=NTa-8tBgsAw62CYTJPliVdrV&size=invisible&cb=vvrbtdopncld:189
We have the same issue (error in browser console) when running testcafe tests against a NextJS app with recaptcha v3. This seems to be an issue for chromium/chrome where as Safari seems to work fine.
Edit:
other: Not seeing this on macOS 10.15 with the same version of Chrome
I am seeing this on MacOS 10.15 with Chrome 87
This is also happening in docker containers (using the latest official testcafe docker image)
Ended up changing our end to end tests to run in firefox instead. Curious what the resolution for this will be.
@konwinkler Thanks, glad you mentioned that - i totally forgot to put that in my report. Safari and Firefox are working just fine for me also
Update: This started failing for me tonight in Safari with a more descriptive error:
[Error] Blocked a frame with origin "http://192.168.5.239:63571" from accessing a frame with origin "http://192.168.5.239:63570". Protocols, domains, and ports must match.
a (hammerhead.js:14:18183)
c (hammerhead.js:14:18559)
p (hammerhead.js:14:18717)
(anonymous function) (hammerhead.js:6:20221)
(anonymous function) (hammerhead.js:6:21953)
(anonymous function) (hammerhead.js:6:23142)
(anonymous function) (hammerhead.js:6:25613)
(anonymous function) (hammerhead.js:15:1639)
(anonymous function) (hammerhead.js:7:31290)
n (hammerhead.js:15:4442)
n (hammerhead.js:8:389)
(anonymous function) (hammerhead.js:7:25108)
@lynners
Hello,
I tried to reproduce this issue under TestCafe v1.10.0/Chrome 87 and it works without any errors.
I suggest you run your tests with the latest TestCafe version (v1.10.0) and let us know your results.
Thanks @Farfurix ! I thought I had tried that but I'm using nvm and looks like I did not update in the correct place. This fixes the problem for Chrome and I am able to log in. While I am also able to log in with Safari now with v1.10.0, just wanted to mention that I still do get a bunch of the errors in the console. Same test case as above but run in Safari 14.0 / macOS 10.15.7:
Blocked a frame with origin "http://192.168.5.239:64866" from accessing a frame with origin "http://192.168.5.239:64865". Protocols, domains, and ports must match.
a — hammerhead.js:14:29555
c — hammerhead.js:14:30027
p — hammerhead.js:14:30242
h — hammerhead.js:14:30825
(anonymous function) — hammerhead.js:6:21432
(anonymous function) — hammerhead.js:6:23164
(anonymous function) — hammerhead.js:6:24353
(anonymous function) — hammerhead.js:6:26824
(anonymous function) — hammerhead.js:15:13551
(anonymous function) — hammerhead.js:8:1744
n — hammerhead.js:15:16354
n — hammerhead.js:8:2853
(anonymous function) — hammerhead.js:7:27218
a — hammerhead.js:14:29555
@lynners, Thank you for your input. I was able to reproduce the behavior you described.
@arubtsov Just wanted to check in - looks like this issue is back for Chrome with v1.10 this morning and is blocking my tests!
I'm also seeing this with Chrome v87 and Testcafe 1.10.0
Same problem here when using Chrome v87.0.4280 and TestCafe v1.9.4 or v1.10.1
When downgrading Chrome to v80.0.3987 reCaptcha works again
@Farfurix thanks for fixing this! Do you know when a new version of testcafe that uses this will be released?
@bdwain
Hello,
You are welcome. We released the [email protected] version that contains these changes. You can use it to check your scenario: npm i testcafe@alpha.
Thanks!! Working great for me
This is still broken for me.
testcafe: 1.10.2-alpha.2
chrome: 88.0.4324.150
Error:
hammerhead.js:12 Uncaught DOMException: Failed to construct 'Worker': Script at 'https://www.google.com/recaptcha/api2/webworker.js?hl=en&v=2Mfykwl2mlvyQZQ3PEgoH710' cannot be accessed from origin 'http://192.168.86.243:61797'.
at new L (http://192.168.86.243:61797/hammerhead.js:12:2245)
at P_.<anonymous> (http://192.168.86.243:61797/D3LnUkIC2!s!utf-8/https://www.gstatic.com/recaptcha/releases/2Mfykwl2mlvyQZQ3PEgoH710/recaptcha__en.js:70:123)
at new P_ (http://192.168.86.243:61797/D3LnUkIC2!s!utf-8/https://www.gstatic.com/recaptcha/releases/2Mfykwl2mlvyQZQ3PEgoH710/recaptcha__en.js:346:381)
at aQ.<anonymous> (http://192.168.86.243:61797/D3LnUkIC2!s!utf-8/https://www.gstatic.com/recaptcha/releases/2Mfykwl2mlvyQZQ3PEgoH710/recaptcha__en.js:181:434)
at new aQ (http://192.168.86.243:61797/D3LnUkIC2!s!utf-8/https://www.gstatic.com/recaptcha/releases/2Mfykwl2mlvyQZQ3PEgoH710/recaptcha__en.js:521:44)
at Object.init (http://192.168.86.243:61797/D3LnUkIC2!s!utf-8/https://www.gstatic.com/recaptcha/releases/2Mfykwl2mlvyQZQ3PEgoH710/recaptcha__en.js:525:94)
at http://192.168.86.243:61797/D3LnUkIC2!i/https://www.google.com/recaptcha/api2/anchor?ar=1&k=6LfPZlEaAAAAAK2iLIQizX5V7Q5kv9Vn3g8gOlsZ&co=aHR0cHM6Ly9kZXYwMS5wb3Bjb3JucmZwLmNvbTo0NDM.&hl=en&v=2Mfykwl2mlvyQZQ3PEgoH710&size=invisible&cb=bg5d91lil4j:189:29
@markanye
Hello,
It looks strange. This issue was fixed in [email protected]. Could you please check your scenario with our latest [email protected]? If the issue still occurs, please create a new bug report with a complete example (or a public URL) using our template.