Environment:
Appium: 1.22.0
Selenium Hub with relay node: 4.1.2
Platform: Android
java_client: 8.0.0
Selenium: 4
This line of code is working fine when I am directly using Appium without Selenium Hub.
AppiumBy.androidUIAutomator(“new UiSelector().resourceId(“username”)”)
But with Selenium Hub, getting error element not found.
ERROR|Element was not found|AppiumBy.androidUIAutomator: new UiSelector().resourceId(“username”)|org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
compared the both request in Appium logs and found one difference.
Without Hub (Direct Appium request)
[WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8200/wd/hub/session/da2a76de-5e37-4223-905d-f34e7dd17fb3/element] with body: {“strategy”:"-android uiautomator",“selector”:“new UiSelector().resourceId(“username”)”,“context”:"",“multiple”:false}
Through Hub:
[WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8200/wd/hub/session/a16a53c4-ec49-466b-a443-1d42107ed291/element] with body: {“strategy”:"-android uiautomator",“selector”:“new UiSelector().resourceId(” android:id /username")",“context”:"",“multiple”:false}
We can see that the difference in resourceId parameter. Somehow Appium is getting “username” but with some appended “android:id” string.
Really appreciate any feedback regarding this error. Thanks