Created
October 9, 2018 02:30
-
-
Save silverbulletmdc/268482de1d845ef16394d8b9137fc37f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/home/dechao_meng/anaconda3/bin/python | |
| import time | |
| import sys | |
| import os | |
| from selenium import webdriver | |
| import pyperclip | |
| recent_value = "" | |
| chrome = webdriver.Chrome() | |
| chrome.get("https://translate.google.com") | |
| input_area = chrome.find_element_by_id('source') | |
| while True: | |
| tmp_value = pyperclip.paste() | |
| if tmp_value != recent_value: | |
| recent_value = tmp_value | |
| print("Value changed: %s" % str(recent_value)[:20]) | |
| tmp_value = tmp_value.replace('\n', ' ') | |
| input_area.clear() | |
| input_area.send_keys(tmp_value) | |
| time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment