Accessing clipboard content in headless mode

2,966 views
Skip to first unread message

parijat patel

unread,
Jun 23, 2021, 11:28:27 PM6/23/21
to Selenium Users
Hi,

I am trying to access clipboard data in headless mode. I checked it in all channels available on Google and it says that headless doesn't support clipboard because of no GUI available in headless mode.

It works fine in normal mode, could you please let me know if there is any way I can access the clipboard data in headless mode or if there is any synthetic clipboard available in headless for use ??

The software I am testing has a specific requirement of checking the data copied to clipboard is correct and hence is not available anywhere else (e.g., local storage, cookies or console) on the software.

It would be great if someone could help me with this !?

Thank you,
Parijat

Rakesh Bhat

unread,
Jun 27, 2021, 12:25:16 PM6/27/21
to seleniu...@googlegroups.com
Yes possible to do

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7fe65c29-48bd-4988-9cce-7d37f91e5c85n%40googlegroups.com.

David

unread,
Jun 27, 2021, 7:29:18 PM6/27/21
to Selenium Users
How do you verify it in normal (GUI) mode? To evaluate/compare how you would do it in headless mode or where it seems problematic in headless mode.

parijat patel

unread,
Jun 28, 2021, 7:44:48 AM6/28/21
to Selenium Users
Using system clipboard in normal mode, the software I am testing copies data to clipboard. Selenium in normal mode picks it up directly, I just had to install xclip package.

In headless mode, there is no clipboard available so the data copied is empty. So I would like to test that the data is still copied in clipboard in headless mode, and confirm it by pasting the copied content to another file (excel, dataframe, word, etc. ..) and check it it is as expected.

Abhijit Mone

unread,
Jun 28, 2021, 7:54:47 AM6/28/21
to seleniu...@googlegroups.com
Are you using java or JavaScript?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

parijat patel

unread,
Jun 28, 2021, 7:58:36 AM6/28/21
to Selenium Users
For testing I am using python + selenium. Testing the function in chromium and on Ubuntu image on git.

Abhijit Mone

unread,
Jun 28, 2021, 8:05:17 AM6/28/21
to seleniu...@googlegroups.com
Okay got it, I'll look into it and let you know.

parijat patel

unread,
Jun 28, 2021, 8:07:20 AM6/28/21
to Selenium Users
Thank you !! I will appreciate your help and time.

avid...@gmail.com

unread,
Sep 29, 2021, 3:58:37 AM9/29/21
to Selenium Users

Is there a way to fetch the data which is in clipboard in ubuntu and headless browser. clipboard.paste()  has no data in ubuntu headless browser but it works fine on windows.

avid...@gmail.com

unread,
Sep 29, 2021, 3:58:40 AM9/29/21
to Selenium Users
what is the solution, please share

On Monday, 28 June 2021 at 17:35:17 UTC+5:30 mone.a...@gmail.com wrote:

avid...@gmail.com

unread,
Oct 4, 2021, 4:31:14 AM10/4/21
to Selenium Users
Hey,

Can you please share the solution.

Thanks in advance.

Анастасия Заречнева

unread,
Jan 26, 2023, 11:45:03 PM1/26/23
to Selenium Users
Reply all
Reply to author
Forward
0 new messages