Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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']
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']