Created
May 9, 2020 14:21
-
-
Save ThibaudLamothe/97ebc56359d1300691b10706dff2136e to your computer and use it in GitHub Desktop.
How to paste text into the DeepL textarea with Selenium
This file contains 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
# Making necessary imports | |
import clipboard | |
from selenium.webdriver.common.keys import Keys | |
# Identifying the text area in the html structure | |
input_css = 'div.lmt__inner_textarea_container textarea' | |
# Connecting to it with our driver | |
input_area = driver.find_element_by_css_selector(input_css) | |
# Set the sentence into the clipboard | |
clipboard.copy(sentence) | |
# Making sure that there is no previous text | |
input_area.clear() | |
# Pasting the copied sentence into the input_area | |
input_area.send_keys(Keys.SHIFT, Keys.INSERT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks, it works