I am doing a script to run Python Selenium and copy some content to clipboard. It has been working nice until I ran it in headless mode. Now it does not copy the text to the clipboard.
Does anyone know how to solve this?
Here it is my configuration
options = webdriver.ChromeOptions()
options.add_experimental_option("prefs", {
"download.default_directory": indir,
"download.prompt_for_download": False,
"download.directory_upgrade": True,
"safebrowsing.enabled": True})
options.add_argument('--headless')
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(chrome_options=options)
I saw something about setting the capabilities but I couldn't fit this in my code, I get a SyntaxError: invalid syntax
.
Answering my own question because some people in the future mught have the same issue... From the results from my searches I think that this is a bug in Windows because I saw someone saying that in MAC OS headless mode and copy/paste from clipboard works fine.
I tried to use
find_by_...('thing here').text
but in my case this was not working, that's why I was copying it to clipboard.Anyways, if this is actually a bug from Windows I would give a try to other browsers (I need this to be Chrome because I am doing a tool for the company and everybody here uses Chrome).
I did not find a solution, I just cut part of my code out since the copy to clipboard part is only usefull for a few people (so these people are gonna run without the headless mode).