{"action":"created","comment":{"url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/comments/212832892","pull_request_review_id":149544836,"id":212832892,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjgzMjg5Mg==","diff_hunk":"@@ -1371,6 +1377,162 @@ public async Task<Response> WaitForNavigationAsync(NavigationOptions options = n\n             return responses.GetValueOrDefault(_frameManager.MainFrame.Url);\n         }\n \n+        /// <summary>\n+        /// Waits for a request.\n+        /// </summary>\n+        /// <example>\n+        /// <code>\n+        /// <![CDATA[\n+        /// var firstRequest = await page.WaitForRequestAsync(\"http://example.com/resource\");\n+        /// return firstRequest.Url;\n+        /// ]]>\n+        /// </code>\n+        /// </example>\n+        /// <returns>A task which resolves when a matching request was made.</returns>\n+        /// <param name=\"url\">URL to wait for.</param>\n+        /// <param name=\"options\">Options.</param>\n+        public async Task<Request> WaitForRequestAsync(string url, WaitForOptions options = null)\n+        {\n+            var timeout = options?.Timeout ?? DefaultWaitForTimeout;\n+            var requestTcs = new TaskCompletionSource<Request>();\n+\n+            void requestEventListener(object sender, RequestEventArgs e)\n+            {\n+                if (e.Request.Url == url)\n+                {\n+                    requestTcs.TrySetResult(e.Request);\n+                    _networkManager.Request -= requestEventListener;\n+                }\n+            }\n+\n+            _networkManager.Request += requestEventListener;\n+\n+            await Task.WhenAny(new[]\n+            {\n+                TaskHelper.CreateTimeoutTask(timeout),\n+                requestTcs.Task\n+            });\n+\n+            return requestTcs.Task.Result;\n+        }\n+\n+        /// <summary>\n+        /// Waits for a request.\n+        /// </summary>\n+        /// <example>\n+        /// <code>\n+        /// <![CDATA[\n+        /// var request = await page.WaitForRequestAsync(request => request.Url === \"http://example.com\" && request.Method === HttpMethod.Get;\n+        /// return request.Url;\n+        /// ]]>\n+        /// </code>\n+        /// </example>\n+        /// <returns>A task which resolves when a matching request was made.</returns>\n+        /// <param name=\"predicate\">Function which looks for a matching request.</param>\n+        /// <param name=\"options\">Options.</param>\n+        public async Task<Request> WaitForRequestAsync(Func<Request, bool> predicate, WaitForOptions options = null)\n+        {\n+            var timeout = options?.Timeout ?? DefaultWaitForTimeout;\n+            var requestTcs = new TaskCompletionSource<Request>();\n+\n+            void requestEventListener(object sender, RequestEventArgs e)\n+            {\n+                if (predicate(e.Request))\n+                {\n+                    requestTcs.TrySetResult(e.Request);\n+                    _networkManager.Request -= requestEventListener;\n+                }\n+            }\n+\n+            _networkManager.Request += requestEventListener;\n+\n+            await Task.WhenAny(new[]\n+            {\n+                TaskHelper.CreateTimeoutTask(timeout),\n+                requestTcs.Task\n+            });\n+\n+            return requestTcs.Task.Result;\n+        }\n+\n+        /// <summary>\n+        /// Waits for a response.\n+        /// </summary>\n+        /// <example>\n+        /// <code>\n+        /// <![CDATA[\n+        /// var firstResponse = await page.WaitForResponseAsync(\"http://example.com/resource\");\n+        /// return firstResponse.Url;\n+        /// ]]>\n+        /// </code>\n+        /// </example>\n+        /// <returns>A task which resolves when a matching response is received.</returns>\n+        /// <param name=\"url\">URL to wait for.</param>\n+        /// <param name=\"options\">Options.</param>\n+        public async Task<Response> WaitForResponseAsync(string url, WaitForOptions options = null)","path":"lib/PuppeteerSharp/Page.cs","position":118,"original_position":118,"commit_id":"5be519a0bfae54d8e4030781639a11809e8837a7","original_commit_id":"5be519a0bfae54d8e4030781639a11809e8837a7","user":{"login":"Meir017","id":9786571,"node_id":"MDQ6VXNlcjk3ODY1NzE=","avatar_url":"https://avatars3.githubusercontent.com/u/9786571?v=4","gravatar_id":"","url":"https://api.github.com/users/Meir017","html_url":"https://github.com/Meir017","followers_url":"https://api.github.com/users/Meir017/followers","following_url":"https://api.github.com/users/Meir017/following{/other_user}","gists_url":"https://api.github.com/users/Meir017/gists{/gist_id}","starred_url":"https://api.github.com/users/Meir017/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Meir017/subscriptions","organizations_url":"https://api.github.com/users/Meir017/orgs","repos_url":"https://api.github.com/users/Meir017/repos","events_url":"https://api.github.com/users/Meir017/events{/privacy}","received_events_url":"https://api.github.com/users/Meir017/received_events","type":"User","site_admin":false},"body":"same here, call `WaitForResponseAsync(Func<Response, bool> predicate, WaitForOptions options = null)`","created_at":"2018-08-26T17:13:14Z","updated_at":"2018-08-26T17:13:25Z","html_url":"https://github.com/kblok/puppeteer-sharp/pull/570#discussion_r212832892","pull_request_url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/comments/212832892"},"html":{"href":"https://github.com/kblok/puppeteer-sharp/pull/570#discussion_r212832892"},"pull_request":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570"}}},"pull_request":{"url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570","id":210952882,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwOTUyODgy","html_url":"https://github.com/kblok/puppeteer-sharp/pull/570","diff_url":"https://github.com/kblok/puppeteer-sharp/pull/570.diff","patch_url":"https://github.com/kblok/puppeteer-sharp/pull/570.patch","issue_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/570","number":570,"state":"open","locked":false,"title":"Page.WaitForRequestAsync and Page.WaitForResponseAsync [DO-NOT-MERGE]","user":{"login":"kblok","id":2198466,"node_id":"MDQ6VXNlcjIxOTg0NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2198466?v=4","gravatar_id":"","url":"https://api.github.com/users/kblok","html_url":"https://github.com/kblok","followers_url":"https://api.github.com/users/kblok/followers","following_url":"https://api.github.com/users/kblok/following{/other_user}","gists_url":"https://api.github.com/users/kblok/gists{/gist_id}","starred_url":"https://api.github.com/users/kblok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kblok/subscriptions","organizations_url":"https://api.github.com/users/kblok/orgs","repos_url":"https://api.github.com/users/kblok/repos","events_url":"https://api.github.com/users/kblok/events{/privacy}","received_events_url":"https://api.github.com/users/kblok/received_events","type":"User","site_admin":false},"body":"Closes #497","created_at":"2018-08-26T13:59:31Z","updated_at":"2018-08-26T17:13:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca91ec7d06cfc5fac9762c9aab01744916bed83c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570/commits","review_comments_url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570/comments","review_comment_url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/570/comments","statuses_url":"https://api.github.com/repos/kblok/puppeteer-sharp/statuses/5be519a0bfae54d8e4030781639a11809e8837a7","head":{"label":"kblok:v1.6/wait-for-request-response","ref":"v1.6/wait-for-request-response","sha":"5be519a0bfae54d8e4030781639a11809e8837a7","user":{"login":"kblok","id":2198466,"node_id":"MDQ6VXNlcjIxOTg0NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2198466?v=4","gravatar_id":"","url":"https://api.github.com/users/kblok","html_url":"https://github.com/kblok","followers_url":"https://api.github.com/users/kblok/followers","following_url":"https://api.github.com/users/kblok/following{/other_user}","gists_url":"https://api.github.com/users/kblok/gists{/gist_id}","starred_url":"https://api.github.com/users/kblok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kblok/subscriptions","organizations_url":"https://api.github.com/users/kblok/orgs","repos_url":"https://api.github.com/users/kblok/repos","events_url":"https://api.github.com/users/kblok/events{/privacy}","received_events_url":"https://api.github.com/users/kblok/received_events","type":"User","site_admin":false},"repo":{"id":105399035,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUzOTkwMzU=","name":"puppeteer-sharp","full_name":"kblok/puppeteer-sharp","owner":{"login":"kblok","id":2198466,"node_id":"MDQ6VXNlcjIxOTg0NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2198466?v=4","gravatar_id":"","url":"https://api.github.com/users/kblok","html_url":"https://github.com/kblok","followers_url":"https://api.github.com/users/kblok/followers","following_url":"https://api.github.com/users/kblok/following{/other_user}","gists_url":"https://api.github.com/users/kblok/gists{/gist_id}","starred_url":"https://api.github.com/users/kblok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kblok/subscriptions","organizations_url":"https://api.github.com/users/kblok/orgs","repos_url":"https://api.github.com/users/kblok/repos","events_url":"https://api.github.com/users/kblok/events{/privacy}","received_events_url":"https://api.github.com/users/kblok/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kblok/puppeteer-sharp","description":"Headless Chrome .NET API","fork":false,"url":"https://api.github.com/repos/kblok/puppeteer-sharp","forks_url":"https://api.github.com/repos/kblok/puppeteer-sharp/forks","keys_url":"https://api.github.com/repos/kblok/puppeteer-sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kblok/puppeteer-sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kblok/puppeteer-sharp/teams","hooks_url":"https://api.github.com/repos/kblok/puppeteer-sharp/hooks","issue_events_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/events{/number}","events_url":"https://api.github.com/repos/kblok/puppeteer-sharp/events","assignees_url":"https://api.github.com/repos/kblok/puppeteer-sharp/assignees{/user}","branches_url":"https://api.github.com/repos/kblok/puppeteer-sharp/branches{/branch}","tags_url":"https://api.github.com/repos/kblok/puppeteer-sharp/tags","blobs_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kblok/puppeteer-sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/kblok/puppeteer-sharp/languages","stargazers_url":"https://api.github.com/repos/kblok/puppeteer-sharp/stargazers","contributors_url":"https://api.github.com/repos/kblok/puppeteer-sharp/contributors","subscribers_url":"https://api.github.com/repos/kblok/puppeteer-sharp/subscribers","subscription_url":"https://api.github.com/repos/kblok/puppeteer-sharp/subscription","commits_url":"https://api.github.com/repos/kblok/puppeteer-sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/kblok/puppeteer-sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/kblok/puppeteer-sharp/contents/{+path}","compare_url":"https://api.github.com/repos/kblok/puppeteer-sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kblok/puppeteer-sharp/merges","archive_url":"https://api.github.com/repos/kblok/puppeteer-sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kblok/puppeteer-sharp/downloads","issues_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues{/number}","pulls_url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/kblok/puppeteer-sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/kblok/puppeteer-sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kblok/puppeteer-sharp/labels{/name}","releases_url":"https://api.github.com/repos/kblok/puppeteer-sharp/releases{/id}","deployments_url":"https://api.github.com/repos/kblok/puppeteer-sharp/deployments","created_at":"2017-09-30T20:32:25Z","updated_at":"2018-08-25T17:01:06Z","pushed_at":"2018-08-26T14:01:15Z","git_url":"git://github.com/kblok/puppeteer-sharp.git","ssh_url":"git@github.com:kblok/puppeteer-sharp.git","clone_url":"https://github.com/kblok/puppeteer-sharp.git","svn_url":"https://github.com/kblok/puppeteer-sharp","homepage":"https://www.puppeteersharp.com","size":1897,"stargazers_count":189,"watchers_count":189,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":41,"open_issues":76,"watchers":189,"default_branch":"master"}},"base":{"label":"kblok:master","ref":"master","sha":"2000ca6e3b19c3134f8575fe57b0432957ecad73","user":{"login":"kblok","id":2198466,"node_id":"MDQ6VXNlcjIxOTg0NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2198466?v=4","gravatar_id":"","url":"https://api.github.com/users/kblok","html_url":"https://github.com/kblok","followers_url":"https://api.github.com/users/kblok/followers","following_url":"https://api.github.com/users/kblok/following{/other_user}","gists_url":"https://api.github.com/users/kblok/gists{/gist_id}","starred_url":"https://api.github.com/users/kblok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kblok/subscriptions","organizations_url":"https://api.github.com/users/kblok/orgs","repos_url":"https://api.github.com/users/kblok/repos","events_url":"https://api.github.com/users/kblok/events{/privacy}","received_events_url":"https://api.github.com/users/kblok/received_events","type":"User","site_admin":false},"repo":{"id":105399035,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUzOTkwMzU=","name":"puppeteer-sharp","full_name":"kblok/puppeteer-sharp","owner":{"login":"kblok","id":2198466,"node_id":"MDQ6VXNlcjIxOTg0NjY=","avatar_url":"https://avatars0.githubusercontent.com/u/2198466?v=4","gravatar_id":"","url":"https://api.github.com/users/kblok","html_url":"https://github.com/kblok","followers_url":"https://api.github.com/users/kblok/followers","following_url":"https://api.github.com/users/kblok/following{/other_user}","gists_url":"https://api.github.com/users/kblok/gists{/gist_id}","starred_url":"https://api.github.com/users/kblok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kblok/subscriptions","organizations_url":"https://api.github.com/users/kblok/orgs","repos_url":"https://api.github.com/users/kblok/repos","events_url":"https://api.github.com/users/kblok/events{/privacy}","received_events_url":"https://api.github.com/users/kblok/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kblok/puppeteer-sharp","description":"Headless Chrome .NET API","fork":false,"url":"https://api.github.com/repos/kblok/puppeteer-sharp","forks_url":"https://api.github.com/repos/kblok/puppeteer-sharp/forks","keys_url":"https://api.github.com/repos/kblok/puppeteer-sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kblok/puppeteer-sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kblok/puppeteer-sharp/teams","hooks_url":"https://api.github.com/repos/kblok/puppeteer-sharp/hooks","issue_events_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/events{/number}","events_url":"https://api.github.com/repos/kblok/puppeteer-sharp/events","assignees_url":"https://api.github.com/repos/kblok/puppeteer-sharp/assignees{/user}","branches_url":"https://api.github.com/repos/kblok/puppeteer-sharp/branches{/branch}","tags_url":"https://api.github.com/repos/kblok/puppeteer-sharp/tags","blobs_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kblok/puppeteer-sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/kblok/puppeteer-sharp/languages","stargazers_url":"https://api.github.com/repos/kblok/puppeteer-sharp/stargazers","contributors_url":"https://api.github.com/repos/kblok/puppeteer-sharp/contributors","subscribers_url":"https://api.github.com/repos/kblok/puppeteer-sharp/subscribers","subscription_url":"https://api.github.com/repos/kblok/puppeteer-sharp/subscription","commits_url":"https://api.github.com/repos/kblok/puppeteer-sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/kblok/puppeteer-sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/kblok/puppeteer-sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/kblok/puppeteer-sharp/contents/{+path}","compare_url":"https://api.github.com/repos/kblok/puppeteer-sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kblok/puppeteer-sharp/merges","archive_url":"https://api.github.com/repos/kblok/puppeteer-sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kblok/puppeteer-sharp/downloads","issues_url":"https://api.github.com/repos/kblok/puppeteer-sharp/issues{/number}","pulls_url":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/kblok/puppeteer-sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/kblok/puppeteer-sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kblok/puppeteer-sharp/labels{/name}","releases_url":"https://api.github.com/repos/kblok/puppeteer-sharp/releases{/id}","deployments_url":"https://api.github.com/repos/kblok/puppeteer-sharp/deployments","created_at":"2017-09-30T20:32:25Z","updated_at":"2018-08-25T17:01:06Z","pushed_at":"2018-08-26T14:01:15Z","git_url":"git://github.com/kblok/puppeteer-sharp.git","ssh_url":"git@github.com:kblok/puppeteer-sharp.git","clone_url":"https://github.com/kblok/puppeteer-sharp.git","svn_url":"https://github.com/kblok/puppeteer-sharp","homepage":"https://www.puppeteersharp.com","size":1897,"stargazers_count":189,"watchers_count":189,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":41,"open_issues":76,"watchers":189,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570"},"html":{"href":"https://github.com/kblok/puppeteer-sharp/pull/570"},"issue":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/570"},"comments":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/issues/570/comments"},"review_comments":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570/comments"},"review_comment":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/pulls/570/commits"},"statuses":{"href":"https://api.github.com/repos/kblok/puppeteer-sharp/statuses/5be519a0bfae54d8e4030781639a11809e8837a7"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Meir017"}}