| 591 | |
| 592 | |
| 593 | class ImageObservationProcessor(ObservationProcessor): |
| 594 | def __init__(self, observation_type: str): |
| 595 | self.observation_type = observation_type |
| 596 | self.observation_tag = "image" |
| 597 | self.meta_data = create_empty_metadata() |
| 598 | |
| 599 | def process(self, page: Page, client: CDPSession) -> npt.NDArray[np.uint8]: |
| 600 | try: |
| 601 | screenshot = png_bytes_to_numpy(page.screenshot()) |
| 602 | except: |
| 603 | page.wait_for_event("load") |
| 604 | screenshot = png_bytes_to_numpy(page.screenshot()) |
| 605 | return screenshot |
| 606 | |
| 607 | |
| 608 | class ObservationHandler: |