How to fetch the text after long press?

Currently - the text on my iPhone and android will stay only if i long press on it.
How to Long press + fetch the text through IDs + release ?

I tried following things :

    TouchAction touchAction = new TouchAction(AndroidAppiumDriverProvider.getAppiumDriver()).longPress(PointOption.point(middleX, middleY)).perform();

// fetch data through ID

The above code is not working

Hi, this is the method long press:

WebElement elem = driver.findElement(By.xpath(“your path”));
((JavascriptExecutor)driver).executeScript(“mobile: longClickGesture”,

i didn’t understand if you want to copy the text, or just to verify if the text is displayed

Thanks for the reply. Will try this out.
The text would disappear in 3 sec if i don’t long tap and hold it on the screen. Want the text displayed on the screen. I want to fetch the text after long tap.
However - long tap is blocking the execution of next line where i’m unable to fetch the data while it is long pressed.

Have you tried to use getText()?
for examples:
if you want to verify that it opens and finds text use assert

String text = driver.findElement(“your id”)).getText();
Assert.assertEquals(text, “text that appear”);