public async Task <JToken> EvalAndWaitForEvent(AsyncFirefoxDriver browserClient, string evalStrAddId, /*int id, */ CancellationToken cancellationToken = new CancellationToken()) { var id = Interlocked.Increment(ref idEvalAndWaitForEvent); try { var evalStr = evalStrAddId.Replace("_AddIdForEventHere_", id.ToString()); // string.Format(evalStrAddId, id); var promise = evalAndWaitForEventAsyncTasks.GetOrAdd(id, i => new TaskCompletionSource <JToken>()); var res = await browserClient?.Eval(evalStr.Replace("\\", "\\\\")); //if (res?["error"] != null) //{ // return res; //} //else //{ cancellationToken.ThrowIfCancellationRequested(); cancellationToken.Register(() => promise.TrySetCanceled(), false); var response = await promise.Task.ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); return(response); //} } finally { evalAndWaitForEventAsyncTasks.TryRemove(id, out TaskCompletionSource <JToken> promise); } }
public FetchClass(AsyncFirefoxDriver browserClient) : base(browserClient) { }
public static Task <FetchResult> Fetch(this AsyncFirefoxDriver browserClient, string url) => new FetchClass(browserClient).Fetch(url);
public EvalAndWaitForEventBase(AsyncFirefoxDriver browserClient) { this.browserClient = browserClient; }
public static AddonManager AddonManager(this AsyncFirefoxDriver browserClient) { return(new AddonManager(browserClient)); }
public static Task <LiveIpResult> GetLiveIp(this AsyncFirefoxDriver browserClient) => new LiveIp(browserClient).GetLiveIp();
public static CacheStorage CacheStorage(this AsyncFirefoxDriver browserClient) { return(new CacheStorage(browserClient)); }
public LivePreferences(AsyncFirefoxDriver browserClient) { this.browserClient = browserClient; }
public AddonManager(AsyncFirefoxDriver browserClient) : base(browserClient) { }
public LiveIp(AsyncFirefoxDriver browserClient) : base(browserClient) { }
public CacheStorage(AsyncFirefoxDriver browserClient) : base(browserClient) { }
public static LivePreferences LivePreferences(this AsyncFirefoxDriver browserClient) { return(new LivePreferences(browserClient)); }
public FirefoxDriverActionExecutor(AsyncFirefoxDriver asyncFirefoxDriver) { this.asyncFirefoxDriver = asyncFirefoxDriver; }