Copy to Clipboard Issue – Running Selenium Headless Browser on GitHub Actions

  Kiến thức lập trình

Here is my code for adding to clipboard:

def add_to_clipboard(text):
     try:
         pyperclip.copy(text)  # Copy the text to the clipboard using pyperclip
     except Exception as e:
         print(f"An error occurred while copying to clipboard: {e}")

When I run this locally, it runs perfect on a non-headless browser. However, when I go to run this through GitHub actions, it does not work because GitHub actions seems to only run on a headless browser.

How should I address this issue?
Is it easy to make my code run on GitHub Actions?
Should I use something besdies GitHub Actions?

Error Code from GitHub Below:
An error occurred while copying to clipboard:
Pyperclip could not find a copy/paste mechanism for your system.
For more information, please visit https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error
(Session info: chrome-headless-shell=124.0.6367.60)

I tried to copy a list in python to be able to paste the data in a website using Selenium. My solution runs locally, however, it does not run on GitHub actions because it is a headless browser.

I need to make the clipboard contents equal to a list so that I can paste tabular data on the page.

New contributor

user24784170 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT