Testcafe basic test execution failed with an error on MachBook Air 11.6.3 (20G405) even after setting the permission for screen recording.
Steps to reproduce
testcafe chrome -e test_suite/tests/temp_test.ts
4. Provide the required permission

Following error is thrown even after giving the permission.
Using locally installed version of TestCafe.
TestCafe requires permission to record the screen. Open 'System Preferences > Security & Privacy > Privacy > Screen Recording' and check 'TestCafe Browser Tools' in the application list.
Press any key to retry.
ERROR UnableToAccessScreenRecordingAPIError: The find-window process cannot access the Screen Recording API.
Please refer to this guide in the TestCafe documentation. It describes how to solve the permission issue on macOS.
Try removing the .testcafe-browser-tools folder from your home directory. If this does not help, try executing the following command:
chmod +x "/Users/{user}/.testcafe-browser-tools/TestCafe Browser Tools.app/Contents/MacOS/testcafe-browser-tools"
Also, if you are using the M1 chip, try installing Rosetta 2. If the problem still persists, i suggest you create an issue in the TestCafe GitHub repository and add a sample project and a video to demonstrate how you reproduce it. Make sure that the callstack with the problem is also visible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With