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


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).


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.


@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).