| 809 | |
| 810 | |
| 811 | class ImageObservationProcessor(ObservationProcessor): |
| 812 | def __init__(self, observation_type: str): |
| 813 | self.observation_type = observation_type |
| 814 | self.observation_tag = "image" |
| 815 | self.meta_data = create_empty_metadata() |
| 816 | |
| 817 | def process(self, page: Page, client: CDPSession, context: str) -> npt.NDArray[np.uint8]: |
| 818 | try: |
| 819 | screenshot = png_bytes_to_numpy(page.screenshot()) |
| 820 | except: |
| 821 | page.wait_for_event("load") |
| 822 | screenshot = png_bytes_to_numpy(page.screenshot()) |
| 823 | return screenshot |
| 824 | |
| 825 | |
| 826 | class ObservationHandler: |