private async Task GetHostedLinkAsync(IBrowserPageInspectSubscription subscription) { for (int i = 0; i < 10; i++, await Task.Delay(1000)) //max number of retries: 10 seconds { var elem = subscription.Page.Root.Query("#skip_button"); if (elem != null) { var href = elem.GetAttribute("href"); if (!string.IsNullOrEmpty(href)) { taskCompletionSource.SetResult(new Uri(href)); return; } } } taskCompletionSource.SetException(new InvalidDOMStructureException("Unable to find the 'skip_button' element")); }
public async void Fulfill(IBrowserPageInspectSubscription subscription) { await pageSubscription(subscription); }