How to click on iOS floating action button?

Hi, I am trying to locate the iOS floating action button and do a long press to take a screenshot. How can I locate the floating action button and do a long press? And yes I know I can take a screenshot using “File file = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);” but it does not save into the phone so I am trying to use the phone itself to take screenshots.

What does Appium Studio Test recording generates (in terms of find of the FAB) you when you use FAB, If it generates good xpath then you can use it to find it and then use Appium Touch Action class to make a Long press. See -

This is what it generates when I click on the FAB during recording
driver.findElement(By.xpath("((//[@text=’ ']/[@class=‘UIAWindow’])[1]/*[@class=‘UIAView’ and @width>0])[2]")).click()

This is the floating action button I am trying to click on. It also doesn’t show up in object spy as an element. But if I change to AssistiveTouch dump, its there but the xpath doesn’t seem to work. xpath in assistivetouch dump : //*[@text=‘AssistiveTouch menu’]

So when you use above xpath to find element, what happens? you could use it and then pass it to Touch Action to long press ?

It is not able to find the element using that xpath, so it doesn’t do anything.