Need to use pyperclip on heroku

123 Views Asked by At

I need to use pyperclip on heroku on a selenium app to copy something to clipboard but as the platform runs a 'headless' browser and has no GUI, a clipboard is obscure. is it possible for me to make this work somehow?

1

There are 1 best solutions below

1
On

Selenium can press ctrl + c to copy.

To copy using python and Selenium, you can use the following code:

from selenium.webdriver.common.action_chains import ActionChains

actions = ActionChains(driver)

actions.key_down(Keys.CONTROL)

actions.send_keys("c")

actions.key_up(Keys.CONTROL)

actions.perform()