public static CdpSession EvalMsg(JObject expression) { return(CdpSession.Create(Methods.RuntimeEval, new JObject { ["expression"] = JObject.FromObject(expression), ["awaitPromise"] = true, ["returnByValue"] = true })); }
public static CdpSession EvalMsg(string script) { return(CdpSession.Create(Methods.RuntimeEval, new JObject { ["expression"] = script, ["awaitPromise"] = true, ["returnByValue"] = true })); }
public CdpRequest(string method, int id, CdpSession request) { _method = method; _id = id; _data = JObject.FromObject(new { id = _id, method = _method }); var pjs = JObject.FromObject(new { sessionId = request.Session }); pjs["message"] = request.AsSerialized(); _data["params"] = pjs; }
private async Task Publish(CdpSession request, CancellationToken token, Action <CdpSession, CdpResponse> callback = null) { Interlocked.Add(ref _methodId, 1); request.Setup(_methodId, _cdpSessionId); _cbMap[_methodId] = new SessionCallback { Id = _methodId, Request = request, Callback = callback ?? HandleCallback }; await Send(new CdpRequest(CdpApi.Methods.TargetSendMsg, _methodId, request)); }
internal static CdpSession EvalMsg(dynamic expression) { return(CdpSession.Create(Methods.RuntimeEval, new { expression, awaitPromise = true, returnByValue = true })); }
internal static CdpSession SetWindowBounds(int windowId, int width, int height, int left = 100, int top = 100, string windowState = "normal") { return(CdpSession.Create(Methods.BrowserSetWinBounds, new { windowId, bounds = new { left, top, width, height, windowState } })); }
internal static CdpSession AddScript(string source) { return(CdpSession.Create(Methods.PageAddScript, new { source })); }
internal static CdpSession AddBinding(string name) { return(CdpSession.Create(Methods.RuntimeAddBind, new { name })); }
internal static CdpSession Navigate(string url) { return(CdpSession.Create(Methods.PageNavigate, new { url })); }
private void HandleCallback(CdpSession request, CdpResponse response) { }
private void Publish(CdpSession message, Action <CdpSession, CdpResponse> callback = null) { Publish(message, CancellationToken.None, callback).Wait(); }
private void Publish(string method, string paramsObj, Action <CdpSession, CdpResponse> callback = null) { Publish(CdpSession.Create(method, paramsObj), CancellationToken.None, callback).Wait(); }
public async Task Execute(CdpSession message, CancellationToken token) { await Publish(message, CancellationToken.None); }