(self, username, password, tab)
| 313 | return self.get_rd_port() |
| 314 | |
| 315 | async def set_auth(self, username, password, tab): |
| 316 | async def auth_challenge_handler(event: cdp.fetch.AuthRequired): |
| 317 | await tab.send( |
| 318 | cdp.fetch.continue_with_auth( |
| 319 | request_id=event.request_id, |
| 320 | auth_challenge_response=cdp.fetch.AuthChallengeResponse( |
| 321 | response="ProvideCredentials", |
| 322 | username=username, |
| 323 | password=password, |
| 324 | ), |
| 325 | ) |
| 326 | ) |
| 327 | |
| 328 | async def req_paused(event: cdp.fetch.RequestPaused): |
| 329 | await tab.send( |
| 330 | cdp.fetch.continue_request(request_id=event.request_id) |
| 331 | ) |
| 332 | |
| 333 | tab.add_handler( |
| 334 | cdp.fetch.RequestPaused, |
| 335 | lambda event: asyncio.create_task(req_paused(event)), |
| 336 | ) |
| 337 | |
| 338 | tab.add_handler( |
| 339 | cdp.fetch.AuthRequired, |
| 340 | lambda event: asyncio.create_task(auth_challenge_handler(event)), |
| 341 | ) |
| 342 | |
| 343 | await tab.send(cdp.fetch.enable(handle_auth_requests=True)) |
| 344 | |
| 345 | async def get( |
| 346 | self, |
no test coverage detected