How do I paste from clipboard?


#1

How to I paste from clipbpard?


#2

!{clipboard} <<< does not work


#8

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

#9

Use selenium:

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

#10

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


#11

Nice catch. My bad :roll_eyes:


#12

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.


#13

if using variables, why to use clipboard?


#14

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.


#15

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