class Playwright::Page
def expect_response(urlOrPredicate, timeout: nil, &block)
return response.ok
response = response_info.value
page.get_by_text("trigger response").click()
with page.expect_response(lambda response: response.url == "https://example.com" and response.status == 200) as response_info:
# or with a lambda
return response.ok
response = response_info.value
page.get_by_text("trigger response").click()
with page.expect_response("https://example.com/resource") as response_info:
```python sync
**Usage**
Returns the matched response. See [waiting for event](../events.md#waiting-for-event) for more details about events.
def expect_response(urlOrPredicate, timeout: nil, &block) wrap_impl(@impl.expect_response(unwrap_impl(urlOrPredicate), timeout: unwrap_impl(timeout), &wrap_block_call(block))) end