Device is connected via ADB Wi-Fi. It is listed also in Device Manager.
When I tried to execute a testcase, got the following error:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
I use this code to set driver:
setDriver (new AndroidDriver (new URL ("http://127.0.0.1:4723/wd/hub"),uiAutomator2OptionsMyRedmi())
private static UiAutomator2Options uiAutomator2OptionsRedmi() {
final UiAutomator2Options uiAutomator2Options;
uiAutomator2Options = new UiAutomator2Options().setAvd("Xiaomi_23021RAA2Y")
.setAvdLaunchTimeout(Duration.ofSeconds(300))
.setAvdReadyTimeout(Duration.ofSeconds(100))
.setDeviceName("Xiaomi_23021RAA2Y")
.setAutomationName(AutomationName.ANDROID_UIAUTOMATOR2)
.setApp(APP_PATH)
.setAppPackage("")
.setAppActivity("com.app.MainActivity")
.setNoReset(false);
return uiAutomator2Options;
}