Skip to content

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DedInc committed May 8, 2024
1 parent ab4bae9 commit ddcc67b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions emunium/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import time
import struct

import keyboard
try:
import keyboard
except ImportError:
keyboard = None

import pyautogui
import pyclick

Expand Down Expand Up @@ -118,22 +122,17 @@ def silent_type(self, text, characters_per_minute=280, offset=20):
randomized_offset = random.uniform(-offset, offset) / 1000
delay = time_per_char + randomized_offset

keyboard.write(char)
time.sleep(delay)

# Update by Pranav (https://github.com/ps428)
# keyboard.write used in silent_type needs sudo mode on Linux machines
# This uses pyautogui.press instead of keyboard.write
def silent_type_pyautogui(self, text, characters_per_minute=280, offset=20):
time_per_char = 60 / characters_per_minute

for i, char in enumerate(text):
randomized_offset = random.uniform(-offset, offset) / 1000
delay = time_per_char + randomized_offset
# Update by Pranav (https://github.com/ps428)
# keyboard.write used in silent_type needs sudo mode on Linux machines
# This uses pyautogui.press instead of keyboard.write
if keyboard is None:
pyautogui.press(char)
else:
keyboard.write(char)

pyautogui.press(char)
time.sleep(delay)


def _scroll_smoothly_to_element(self, element_rect):
window_width = self.browser_inner_window[0]
window_height = self.browser_inner_window[1]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='emunium',
version='2.0.0',
version='2.0.1',
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.',
Expand Down

0 comments on commit ddcc67b

Please sign in to comment.