How do I paste from clipboard?

How to I paste from clipbpard?

!{clipboard} <<< does not work

Looks like Katalon can not operate the clipboard other than through shortcut keys combinations. I also struggled with getting value from clipboard, and in the end came up with an idea of importing java libs Katalon is using, and save clipboard data to a variable in test case script:

import java.awt.Toolkit
import java.awt.datatransfer.DataFlavor


String my_clipboard = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor);

// use my_clipboard variable where it is relevant
1 Like

Use selenium:

WebElement element = WebUiCommonHelper.findWebElement("path/to/my/test/object", 30);
element.sendKeys(Keys.chord(Keys.LEFT_CONTROL, "v"));

Guys - this is for Katalon Recorder (not Studio).

1 Like

Nice catch. My bad :roll_eyes:

I am not sure this does what is needed. In your example you will just paste clipboard into an element on the website you are working on atm. And what is needed sometimes is to save clipboard value into a variable for further use.

if using variables, why to use clipboard?

This is not what the OP asked for:

The target of his paste is not mentioned. He makes no mention of saving anything to a variable.

1 Like

@d.semenduev if you have specific needs (maybe similar with the actual topic but with more scenarios) you can open a new one, more descriptive.
imho the actual one is solved … as no solution found :smiley:

also you din’t pay attention at …

Guys - this is for Katalon Recorder (not Studio).

Wow…this worked for me. Thanks a lot… @d.semenduev

Hello, if you want to copy some value of the site i suggest using Robot.
Do a doubleClick on the element to select, then use Robot to do Ctrl+C (this will put the value in the clipboard).
This piece of code will execute the copy

Robot robot = new Robot()

Then you can use the clipboard