Closed deschandhok24 closed 2 months ago
`async def _get_browser_properties_if_not_found(self, screenshot_func): if not self.browser_offsets or not self.browser_inner_window: with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file: temp_screen_path = temp_file.name if asyncio.iscoroutinefunction(screenshot_func): await screenshot_func(temp_screen_path) else: screenshot_func(temp_screen_path)
location = pyautogui.locateOnScreen(temp_screen_path, confidence=0.0)
self.browser_offsets = (
location.left,
location.top,
)
self.browser_inner_window = get_image_size(temp_screen_path)
os.remove(temp_screen_path)`
Make confidence to 0.0 . This is a hack. not sure what exactly this screenshot is required for apart from screensize. Developer has used very clever way of getting offset of browser.
I tried the script for playwright and selenium in the examples you show and it doesnt work. It goes to wrong element or raises ImageNotFoundException due to confidence being to low.