How to send some String value to ios real device clipboard using appium V2?

I’ve searched over the topics regarding this issue and can’t find any solution that can help me with this especially with java client 8 + appium v 2.x !

i’m trying to get the text from my test class for ex. hello and try to past it into the iOS clipboard but unfortunately it seems the value is null or empty string …

I’m using the following code language : java + selenium framework

all other topics regarding this issue is mentioning to use the following command :

driver.setClipboard("label", ClipboardContentType.PLAINTEXT, base64Content);
driver.setClipboardText("happy testing");

the previous command is not working with new Appiumdriver/driver since it’s using java client 8 the method setClipboard is not listed there !

  • i tried the way they said to put the app in foreground but is not working for new appium 2.x + java client 8 since the most of the methods has been deprecated

Set the content of the system clipboard (For iOS 15+ real devices)
Apple security preferences require the WebDriverAgentRunner
application to be in foreground in order to set the system clipboard
content. Consider using Activate App and Background App to change the
foreground application. Activate App command cannot launch the
WebDriverAgent properly on some environments. It depends on XCTest
framework by Apple. Then, you should launch the WebDriverAgent using
its Springboard’s application icon. Follow the example below. 1. Open
Springboard, @driver.activate_app ‘’. 2. Find the
WDA icon with @driver.find_element :accessibility_id,
‘WebDriverAgentRunner-Runner’ (It should be visible on the screen) and
click it. 3. Call the get clipboard API. 4. Open the application under
test with the Activate App.

((HasClipboard) driver).setClipboardText(“happy testing”);

still not sending any values !

 StringSelection selection = new StringSelection(theString);
 Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
 clipboard.setContents(selection, selection);

it’s working on when i paste the text from my Mac clipboard but still not sending any values to iOS !

plz can anyone help me with this ?

NOTE: i tried all the previous solutions but nothing are working with new Appium 2.x + java client 8