0

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 : https://appium.io/docs/en/commands/device/clipboard/set-clipboard/

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 'com.apple.springboard'. 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

Majood
  • 21
  • 2
  • Did you try starting the WDA from the Springboard as described or only using `driver.activateApp`? – drunkencheetah Oct 19 '22 at 13:56
  • 1
    thank yo it's working now my problem was how to open springboard app and i found that it's `Springboard is the internal function that launches apps when you tap on their icon on the Home screen. You can’t see it, but you use it every time you launch an app or switch apps` my problem was solved thanks @drunkencheetah – Majood Oct 22 '22 at 20:05

1 Answers1

1

my problem has been solved

  • solution is :

https://appium.io/docs/en/commands/device/clipboard/set-clipboard/

++ Springboard is the internal function that launches apps when you tap on their icon on the Home screen. You can’t see it, but you use it every time you launch an app or switch apps

Majood
  • 21
  • 2