Home > Mobile >  Testcafe tests are not executed on MacBook Big Sur with UnableToAccessScreenRecordingAPIError:
Testcafe tests are not executed on MacBook Big Sur with UnableToAccessScreenRecordingAPIError:

Time:02-15

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

  1. Create a basic test
  2. Run the test from the command line

testcafe chrome -e test_suite/tests/temp_test.ts

  1. It prompts for permission to record the screen

enter image description here 4. Provide the required permission

enter image description here

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.

CodePudding user response:

Please refer to this guide in the TestCafe documentation. It describes how to solve the permission issue on macOS.

CodePudding user response:

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.

  • Related