iOS 15 Element no longer attached to the DOM

I see: “Request failed with status 500 due to Error: An element command failed because the referenced element is no longer attached to the DOM” constantly on iOS 15, appium 1.22.0. My tests run fine on iOS 14 and iOS 13. Has anyone else seen this?
It is a hybrid app. I’m seeing this issue when switching to the web context and interacting with elements in the dom.

Just search element again.

yea will try but it happens on almost every element on iOS 15. Any idea why that would be the case but not on iOS 14?

It is just a way you writing code. In best scenario EVERY element try use should call element search first.

Do you mean should use findElement? I am using findElement, My point is that what worked perfectly on the previous two versions of iOS has stopped working with iOS 15.

It can be findElement. in such case your code is like:

// java
By myButtonBy = MobileBy.id("myButtonID");
tap(myButtonBy);

I like better java appium annotations:

@iOSXCUITFindBy(id = "myButtonID_android")
@AndroidFindBy(id = "myButtonID_ios")
private MobileElement myButton;

public HomePage tapMyButton() {
    Assert.assertTrue(tap(myButton), "FAILED tap 'myButton'");
    return new HomePage(page);
}

It was using jsonwp and failing. When I switched to using w3c it started working

Can you elaborate on how this issue is solved for iOS 15. How to change from JSONWP to W3C in appium