Issue
I am working with a form that does not allow to type accents, but it does allow to paste text with accent.
How can I send text to the clipboard, then paste the text containing accent into the form?
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
options = Options()
options.headless = True
driver = webdriver.Chrome('chromedriver.exe',options=options)
driver.get('https://www.website.com')
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, openform))).click()
send accent text to clipboard
driver.find_element(By.XPATH, formfield).send_keys(Keys.CONTROL, 'v')
Solution
You could try this in python to copy the desired text in clipboard and then pasting it. It is working with python 3.8. You can try it too. if you face any issue then let me know.
import pyperclip
pyperclip.copy('Text to be copied to the clipboard.')
clipboard_text= pyperclip.paste()
print(clipboard_text)
Answered By - UnknownBeast
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.