How to use the pyppeteer.errors.ProtocolError function in pyppeteer

To help you get started, we’ve selected a few pyppeteer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github web-platform-tests / wpt / tools / pyppeteer / pyppeteer / connection.py View on Github external
message = {
            'id': message_id,
            'method': method,
            'params': params
        }

        self.logger.debug('SEND %s' % (message,))
        self._websocket.send(wspy.Frame(
            wspy.OPCODE_TEXT, json.dumps(message), mask=True
        ))

        lock.acquire()
        result = self._results.pop(message_id)

        if 'error' in result:
            raise ProtocolError(method, result['error'])
        if isinstance(result, Exception):
            raise result

        return result['result']
github web-platform-tests / wpt / tools / pyppeteer / pyppeteer / session.py View on Github external
message = {
            'id': message_id,
            'method': method,
            'params': params
        }
        self.logger.debug('SEND %s' % (message,))
        self.connection.send(
            'Target.sendMessageToTarget',  # API status: stable
            {'sessionId': self._id, 'message': json.dumps(message)}
        )

        lock.acquire()
        result = self._results.pop(message_id)

        if 'error' in result:
            raise ProtocolError(method, result['error'])

        if isinstance(result, Exception):
            raise result

        if method == 'Input.dispatchMouseEvent':
            self._on_mouse_move(params)

        return result['result']