import type { FlutterDriver } from '../driver';
export const getScreenshot = async function(this: FlutterDriver) {
const response = await this.socket!.call(`_flutter.screenshot`) as any;
return response.screenshot;
};
this screen.ts file returns 500 error code.
logs are as follows:
[2fc648d0][FlutterDriver] Executing Flutter driver command 'getScreenshot'
[2fc648d0][FlutterDriver@dd93] [ '{"code":-32000,"message":"Could not capture image screenshot."}' ]
[2fc648d0][FlutterDriver@dd93] Encountered internal error running command: Error: {"code":-32000,"message":"Could not capture image screenshot."}
at Object.errorWithException (/Users/michael/node_modules/@appium/support/lib/logging.js:41:45)
at Object.errorAndThrow (/Users/michael/node_modules/@appium/support/lib/logging.js:44:18)
at IsolateSocket.socket.call (/Users/michael/node_modules/appium-flutter-driver/lib/sessions/observatory.ts:64:20)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at FlutterDriver.getScreenshot (/Users/michael/node_modules/appium-flutter-driver/lib/commands/screen.ts:4:20)
How to solve this issue?