diff --git a/emunium/__pycache__/__init__.cpython-310.pyc b/emunium/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..d8d0344 Binary files /dev/null and b/emunium/__pycache__/__init__.cpython-310.pyc differ diff --git a/emunium/__pycache__/base.cpython-310.pyc b/emunium/__pycache__/base.cpython-310.pyc new file mode 100644 index 0000000..454703e Binary files /dev/null and b/emunium/__pycache__/base.cpython-310.pyc differ diff --git a/emunium/__pycache__/browsers.cpython-310.pyc b/emunium/__pycache__/browsers.cpython-310.pyc new file mode 100644 index 0000000..7ea7168 Binary files /dev/null and b/emunium/__pycache__/browsers.cpython-310.pyc differ diff --git a/emunium/__pycache__/standalone.cpython-310.pyc b/emunium/__pycache__/standalone.cpython-310.pyc new file mode 100644 index 0000000..eb8bcb2 Binary files /dev/null and b/emunium/__pycache__/standalone.cpython-310.pyc differ diff --git a/emunium/base.py b/emunium/base.py index e3fd6b6..7a443c9 100644 --- a/emunium/base.py +++ b/emunium/base.py @@ -66,7 +66,8 @@ async def _get_browser_properties_if_not_found(self, screenshot_func): await screenshot_func(temp_screen_path) else: screenshot_func(temp_screen_path) - location = pyautogui.locateOnScreen(temp_screen_path, confidence=0.8) + + location = pyautogui.locateOnScreen(temp_screen_path, confidence=0.6) self.browser_offsets = ( location.left, location.top, diff --git a/emunium/browsers.py b/emunium/browsers.py index 86bd2fd..49181d9 100644 --- a/emunium/browsers.py +++ b/emunium/browsers.py @@ -72,7 +72,7 @@ async def type_at(self, element, text, characters_per_minute=280, offset=20, cli center = await self.get_center(element) self._move(center) self._click(click_type) - await self.silent_type(text, characters_per_minute, offset) + self.silent_type(text, characters_per_minute, offset) async def scroll_to(self, element): await self._get_browser_properties_if_not_found() @@ -91,7 +91,14 @@ def __init__(self, page): async def _get_browser_properties_if_not_found(self): async def screenshot_func(path): - await self.page.screenshot(path=path) + viewport_size = self.page.viewport_size + clip = { + 'x': 0, + 'y': 0, + 'width': viewport_size['width'] // 2, + 'height': viewport_size['height'] // 2 + } + await self.page.screenshot(path=path, clip=clip) await super()._get_browser_properties_if_not_found(screenshot_func) async def get_center(self, element): @@ -116,7 +123,7 @@ async def type_at(self, element, text, characters_per_minute=280, offset=20, cli center = await self.get_center(element) self._move(center) self._click(click_type) - await self.silent_type(text, characters_per_minute, offset) + self.silent_type(text, characters_per_minute, offset) async def scroll_to(self, element): await self._get_browser_properties_if_not_found() @@ -125,4 +132,4 @@ async def scroll_to(self, element): if element_rect is None: return None - self._scroll_smoothly_to_element(element_rect) + self._scroll_smoothly_to_element(element_rect) \ No newline at end of file diff --git a/setup.py b/setup.py index 7969450..1c51eec 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='emunium', - version='2.0.1', + version='2.0.2', author='Maehdakvan', author_email='visitanimation@google.com', description='A Python module for automating interactions to mimic human behavior in standalone apps or browsers when using Selenium, Pyppeteer, or Playwright.',