"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.STRINGS_TO_RETRY_ON = exports.ELEMENT_NOT_ATTACHED_ERROR = exports.ELEMENT_NOT_READY_ERROR = void 0;
exports.isRetriableError = isRetriableError;
exports.ELEMENT_NOT_READY_ERROR = 'ELEMENT_NOT_READY_ERROR';
exports.ELEMENT_NOT_ATTACHED_ERROR = 'Element is not attached to the DOM';
const GET_CONTENT_FRAME_ERROR_TEXT = 'Could not get content frame from current frame';
const MABL_FIND_LOGIC_TIMEOUT_ERROR_TYPE = 'Mabl find logic timeout';
exports.STRINGS_TO_RETRY_ON = [
    exports.ELEMENT_NOT_READY_ERROR,
    'Node is either not visible or',
    'Node is detached',
    exports.ELEMENT_NOT_ATTACHED_ERROR,
    'Execution context was destroyed',
    'Element is not attached',
    'TimeoutError',
    MABL_FIND_LOGIC_TIMEOUT_ERROR_TYPE,
    'Protocol error (DOM.describeNode)',
    GET_CONTENT_FRAME_ERROR_TEXT,
    'frame.evaluate: Target closed',
    'frame.evaluateHandle: Frame was detached',
    'JSHandles can be evaluated only in the context they were created',
    'Unable to adopt element handle from a different document',
    'Cannot find context with specified id',
    'Cannot find object with id',
    'Node not found',
    'stale element reference',
    'referenced element is no longer attached',
    'is not present in the current view anymore',
    'addBinding',
];
function isRetriableError(error) {
    return exports.STRINGS_TO_RETRY_ON.some((errorMessage) => error.message.toLowerCase().includes(errorMessage.toLowerCase()));
}
