I'm on a Mac, writing node.js (v16.19.0) test automation for an app running on an Android emulator (API 34 browser version 14). I'm trying to tap a button in the app that is always seen by the Appium Inspector (2023.12.2, Electron: 13.6.9, Node.js: 14.16.0), but 'cannot be found' when the automation is run (locally or against SauceLabs, Appium 2.0.0, webDriver protocol w3c). The view is a native view and not a web view. Screenshots work fine, so there don't appear to be any security restrictions on the view as you might find on views that deal with merchant data like credit cards. I've also added hard timing that gives ample time for the element to load before the tap attempt occurs. And when the SauceLabs movie link is accessed, the button is always visible in the replay even though the log shows that the element 'cannot be found':
Error: element [android=new UiSelector().className("android.widget.Button").index(0).instance(1)] referenced by map [ui.screen.reserve_dining.containers.time.buttons.all_day] still not existing after 30000ms
Each of the locators listed below, work perfectly in Appium Inspector, but fail to work when run against SauceLabs:
buttons: {
all_day: {
// self: 'android=new UiSelector().className("android.widget.Button").textContains("All Day")'
// self: 'android=new UiSelector().className("android.widget.Button").text("Go To All Day Availability Results")'
// self: 'android=new UiSelector().className("android.widget.Button").text("Go To All Day Availability Results").index(0).instance(1)'
// self: '//android.view.View[4]/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.view.View/android.widget.Button'
// self: '//android.widget.Button[@resource-id="undefined" and @text="Go To All Day Availability Results"]'
self: 'android=new UiSelector().className("android.widget.Button").index(0).instance(1)'
},
I'm at a loss about how to resolve this. I can indeed tap the button location by coordinate and activate the button--that does work, but I shouldn't have to do this. My locators are valid. I have the same emulator settings locally as are configured on SauceLabs, so there's no apparent environment setup mismatch that could be at play.
Is this a known issue with Appium? I'd love to hear your feedback!
Thanks.

capabilities.setCapability("appium:settings[allowInvisibleElements]", true); capabilities.setCapability("appium:settings[ignoreUnimportantViews]", false); capabilities.setCapability("appium:settings[enableMultiWindows]", true);