When using Appium2 for automated testing of the Edge browser on an Android device, the phone's default browser opens instead of Edge

I am attempting to perform automated testing of the Edge browser on an Android real device using Appium2. What confuses me is that executing the script below successfully navigates to the target webpage, but the default factory-installed browser opens instead of Edge. I have confirmed that Edge is successfully installed on my phone.

Environment infos:

  • Host: MacBook Pro M3
  • Android: 11.0.0 (real device)
  • Appium Server: 2.12.1
  • Appium-Python-Client: 5.1.1
from appium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium.webdriver.webdriver import AppiumOptions

import time
import os
import subprocess
import json


def test_main():
    desired_capabilities = {
        "platformName": "Android",
        "browserName": "MSEdge",
        "automationName": "UiAutomator2",
        "appium:deviceName": "3405331233000MD",
    }

    options = AppiumOptions()
    options.load_capabilities(desired_capabilities)

    driver = webdriver.Remote("http://localhost:4723", options=options)

    try:
        driver.get("https://www.okx.com/zh-hans-sg/account/login")
        time.sleep(3)

        # ...
    except Exception as e:
        print(e)
    finally:
        driver.quit()


if __name__ == '__main__':
    test_main()

Edge is already installed on my device:

Although the webpage opens, it is not in Edge but in the default browser:

By the way, I can conduct automated testing with Chrome and Firefox (using Geckodriver) without any issues; the problem only occurs with Edge.

Please provide the full server log. Also make sure you download the correct edge driver

Thank you for your reply.

After I specified the edgeDriverPath in th caps like this:

desired_capabilities = {
    "platformName": "Android",
    "browserName": "MSEdge",
    "automationName": "UiAutomator2",
    "appium:deviceName": "3405331233000MD",
    "edgeDriverPath": "/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver",
    "appium:showChromedriverLog": True,
}

The problem still exists. And I got the appium server log as below:

(.venv) ➜  AndroidSeleniumTest appium --allow-insecure=chromedriver_autodownload --allow-cors
[Appium] Welcome to Appium v2.12.1
[Appium] Non-default server args:
[Appium] {
  allowCors: true,
  allowInsecure: [
    'chromedriver_autodownload'
  ]
}
[Appium] The autodetected Appium home path: /Users/stanleyhong/.appium
[Appium] Attempting to load driver xcuitest...
[Appium] Attempting to load driver uiautomator2...
[Appium] Attempting to load driver gecko...
[Appium] Requiring driver at /Users/stanleyhong/.appium/node_modules/appium-xcuitest-driver/build/index.js
[Appium] Requiring driver at /Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/build/index.js
[Appium] Requiring driver at /Users/stanleyhong/.appium/node_modules/appium-geckodriver/build/index.js
[Appium] XCUITestDriver has been successfully loaded in 0.354s
[Appium] AndroidUiautomator2Driver has been successfully loaded in 0.354s
[Appium] GeckoDriver has been successfully loaded in 0.354s
[Appium] You have enabled CORS requests from any host. Be careful not to visit sites which could maliciously try to start Appium sessions on your machine
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLs in your client code to connect to this server:
        http://127.0.0.1:4723/ (only accessible from the same host)
        http://169.254.15.124:4723/
        http://10.26.137.14:4723/
        http://192.168.255.10:4723/
[Appium] Available drivers:
[Appium]   - [email protected] (automationName 'XCUITest')
[Appium]   - [email protected] (automationName 'UiAutomator2')
[Appium]   - [email protected] (automationName 'Gecko')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
[HTTP] Request idempotency key: aaf846b5-de24-44f4-b8eb-f1ed36c72a25
[HTTP] --> POST /session {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","browserName":"MSEdge","appium:automationName":"UiAutomator2","appium:deviceName":"3405331233000MD","appium:edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","appium:showChromedriverLog":true}}}
[AppiumDriver@4077] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","browserName":"MSEdge","appium:automationName":"UiAutomator2","appium:deviceName":"3405331233000MD","appium:edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","appium:showChromedriverLog":true}}]
[AppiumDriver@4077] Event 'newSessionRequested' logged at 1747050386861 (19:46:26 GMT+0800 (China Standard Time))
[Appium] Attempting to find matching driver for automationName 'UiAutomator2' and platformName 'Android'
[Appium] The 'uiautomator2' driver was installed and matched caps.
[Appium] Will require it at /Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver
[Appium] Requiring driver at /Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/build/index.js
[AppiumDriver@4077] Appium v2.12.1 creating new AndroidUiautomator2Driver (v4.2.3) session
[AppiumDriver@4077] Checking BaseDriver versions for Appium and AndroidUiautomator2Driver
[AppiumDriver@4077] Appium's BaseDriver version is 9.17.0
[AppiumDriver@4077] AndroidUiautomator2Driver's BaseDriver version is 9.17.0
[AppiumDriver@4077] Explicitly enabling use of insecure features:
[AppiumDriver@4077]     chromedriver_autodownload
-[AndroidUiautomator2Driver@e302] 
-[AndroidUiautomator2Driver@e302] Creating session with W3C capabilities: {
  "alwaysMatch": {
    "platformName": "Android",
    "browserName": "MSEdge",
    "appium:automationName": "UiAutomator2",
    "appium:deviceName": "3405331233000MD",
    "appium:edgeDriverPath": "/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver",
    "appium:showChromedriverLog": true
  },
  "firstMatch": [
    {}
  ]
}
-[AndroidUiautomator2Driver@e302] The following provided capabilities were not recognized by this driver:
-[AndroidUiautomator2Driver@e302]   edgeDriverPath
[5b3e818a]-[AndroidUiautomator2Driver@e302] Session created with session id: 5b3e818a-91ec-49b8-bd2b-08e415fc6157
[5b3e818a][ADB] Found 4 'build-tools' folders under '/Users/stanleyhong/Library/Android/sdk' (newest first):
[5b3e818a][ADB]     /Users/stanleyhong/Library/Android/sdk/build-tools/35.0.0
[5b3e818a][ADB]     /Users/stanleyhong/Library/Android/sdk/build-tools/34.0.0
[5b3e818a][ADB]     /Users/stanleyhong/Library/Android/sdk/build-tools/30.0.3
[5b3e818a][ADB]     /Users/stanleyhong/Library/Android/sdk/build-tools/30.0.2
[5b3e818a][ADB] Using 'adb' from '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 start-server'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Retrieving device list
[5b3e818a][ADB] Trying to find connected Android devices
[5b3e818a][ADB] Getting connected devices
[5b3e818a][ADB] Connected devices: [{"udid":"3405331233000MD","state":"device"}]
[5b3e818a]-[AndroidUiautomator2Driver@e302] Using device: 3405331233000MD
[5b3e818a][ADB] Using 'adb' from '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 start-server'
[5b3e818a][ADB] Setting device id to 3405331233000MD
[5b3e818a]-[AndroidUiautomator2Driver@e302] Neither 'app' nor 'appPackage' was set. Starting UiAutomator2 without the target application
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell getprop ro.build.version.sdk'
[5b3e818a][ADB] Current device property 'ro.build.version.sdk': 30
[5b3e818a][ADB] Getting device platform version
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell getprop ro.build.version.release'
[5b3e818a][ADB] Current device property 'ro.build.version.release': 11
[5b3e818a][ADB] Device API level: 30
[5b3e818a]-[AndroidUiautomator2Driver@e302] Relaxing hidden api policy
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell 'settings put global hidden_api_policy_pre_p_apps 1;settings put global hidden_api_policy_p_apps 1;settings put global hidden_api_policy 1''
[5b3e818a]-[AndroidUiautomator2Driver@e302] Pushing settings apk to the device...
[5b3e818a][ADB] Getting package info for 'io.appium.settings'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell dumpsys package io.appium.settings'
[5b3e818a][ADB] Using 'aapt2' from '/Users/stanleyhong/Library/Android/sdk/build-tools/35.0.0/aapt2'
[5b3e818a][ADB] Reading package manifest: '/Users/stanleyhong/Library/Android/sdk/build-tools/35.0.0/aapt2 dump badging /Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[5b3e818a][ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('5.14.8' >= '5.14.8')
[5b3e818a][ADB] There is no need to install/upgrade '/Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell dumpsys activity services io.appium.settings'
[5b3e818a]-[AndroidUiautomator2Driver@e302] io.appium.settings is already running. There is no need to reset its permissions.
[5b3e818a][Logcat] Starting logs capture with command: /Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD logcat -v threadtime
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell appops set io.appium.settings android:mock_location allow'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell "[ -e '/data/local/tmp/mock_apps.json' ] && echo __PASS__"'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell cat /data/local/tmp/mock_apps.json'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Forwarding UiAutomator2 Server port 6790 to local port 8200
[5b3e818a][ADB] Forwarding system: 8200 to device: 6790
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD forward tcp:8200 tcp:6790'
[5b3e818a]-[AndroidUiautomator2Driver@e302] UIA2Proxy options: {"server":"127.0.0.1","port":8200,"keepAlive":true,"scheme":"http","base":"","reqBasePath":"","sessionId":null,"timeout":240000}
[5b3e818a][ADB] Getting package info for 'io.appium.uiautomator2.server'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell dumpsys package io.appium.uiautomator2.server'
[5b3e818a][ADB] Getting install status for io.appium.uiautomator2.server.test
[5b3e818a]-[AndroidUiautomator2Driver@e302] No app capability. Assuming it is already on the device
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell cmd package list packages'
[5b3e818a][ADB] Reading package manifest: '/Users/stanleyhong/Library/Android/sdk/build-tools/35.0.0/aapt2 dump badging /Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v7.5.2.apk'
[5b3e818a][ADB] 'io.appium.uiautomator2.server.test' is installed
[5b3e818a][ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('7.5.2' >= '7.5.2')
[5b3e818a]-[AndroidUiautomator2Driver@e302] Server packages status: [{"installState":"sameVersionInstalled","appPath":"/Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v7.5.2.apk","appId":"io.appium.uiautomator2.server"},{"installState":"sameVersionInstalled","appPath":"/Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk","appId":"io.appium.uiautomator2.server.test"}]
[5b3e818a]-[AndroidUiautomator2Driver@e302] Server packages are not going to be (re)installed
[5b3e818a]-[AndroidUiautomator2Driver@e302] Waiting up to 30000ms for services to be available
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell pm list instrumentation'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[5b3e818a][ADB] Adding packages ["io.appium.settings","io.appium.uiautomator2.server","io.appium.uiautomator2.server.test"] to Doze whitelist
[5b3e818a][ADB] Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server.test",";"]]
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Performing shallow cleanup of automation leftovers
[5b3e818a]-[AndroidUiautomator2Driver@e302] No obsolete sessions have been detected (timeout of 500ms exceeded)
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell am force-stop io.appium.uiautomator2.server'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell am force-stop io.appium.uiautomator2.server.test'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Starting UIAutomator2 server 7.5.2
[5b3e818a]-[AndroidUiautomator2Driver@e302] Using UIAutomator2 server from '/Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v7.5.2.apk' and test from '/Users/stanleyhong/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Waiting up to 30000ms for UiAutomator2 to be online...
[5b3e818a][ADB] Creating ADB subprocess with args: ["-P","5037","-s","3405331233000MD","shell","am","instrument","-w","-e","disableAnalytics","true","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[5b3e818a]-[AndroidUiautomator2Driver@e302] Matched '/status' to command name 'getStatus'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [GET /status] to [GET http://127.0.0.1:8200/status] with no body
[5b3e818a]-[AndroidUiautomator2Driver@e302] socket hang up
[5b3e818a]-[AndroidUiautomator2Driver@e302] Matched '/status' to command name 'getStatus'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [GET /status] to [GET http://127.0.0.1:8200/status] with no body
[5b3e818a]-[AndroidUiautomator2Driver@e302] socket hang up
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] 
[5b3e818a]-[AndroidUiautomator2Driver@e302] Matched '/status' to command name 'getStatus'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [GET /status] to [GET http://127.0.0.1:8200/status] with no body
[5b3e818a]-[AndroidUiautomator2Driver@e302] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
[5b3e818a]-[AndroidUiautomator2Driver@e302] The initialization of the instrumentation process took 2185ms
[5b3e818a]-[AndroidUiautomator2Driver@e302] Matched '/session' to command name 'createSession'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [POST /session] to [POST http://127.0.0.1:8200/session] with body: {"capabilities":{"firstMatch":[{"platformName":"Android","browserName":"MSEdge","automationName":"UiAutomator2","deviceName":"3405331233000MD","edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","showChromedriverLog":true,"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","browserName":"MSEdge","automationName":"UiAutomator2","deviceName":"3405331233000MD","edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","showChromedriverLog":true},"deviceUDID":"3405331233000MD"}],"alwaysMatch":{}}}
[5b3e818a]-[AndroidUiautomator2Driver@e302] Got response with status 200: {"sessionId":"45cc88f8-1aad-427e-a0bf-115e94fcb115","value":{"capabilities":{"firstMatch":[{"platformName":"Android","browserName":"MSEdge","automationName":"UiAutomator2","deviceName":"3405331233000MD","edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","showChromedriverLog":true,"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","browserName":"MSEdge","automationName":"UiAutomator2","deviceName":"3405331233000MD","edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","showChromedriverLog":true},"deviceUDID":"3405331233000MD"}],"alwaysMatch":{}},"sessionId":"45cc88f8-1aad-427e-a0bf-115e94fcb115"}}
[5b3e818a]-[AndroidUiautomator2Driver@e302] Determined the downstream protocol as 'W3C'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [GET /appium/device/pixel_ratio] to [GET http://127.0.0.1:8200/session/45cc88f8-1aad-427e-a0bf-115e94fcb115/appium/device/pixel_ratio] with no body
[5b3e818a]-[AndroidUiautomator2Driver@e302] Matched '/appium/device/system_bars' to command name 'getSystemBars'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [GET /appium/device/system_bars] to [GET http://127.0.0.1:8200/session/45cc88f8-1aad-427e-a0bf-115e94fcb115/appium/device/system_bars] with no body
[5b3e818a]-[AndroidUiautomator2Driver@e302] Matched '/window/current/size' to command name 'getWindowSize'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [GET /window/current/size] to [GET http://127.0.0.1:8200/session/45cc88f8-1aad-427e-a0bf-115e94fcb115/window/current/size] with no body
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8200/session/45cc88f8-1aad-427e-a0bf-115e94fcb115/appium/device/info] with no body
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell dumpsys window'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell dumpsys power'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Got response with status 200: {"sessionId":"45cc88f8-1aad-427e-a0bf-115e94fcb115","value":3}
[5b3e818a]-[AndroidUiautomator2Driver@e302] Got response with status 200: {"sessionId":"45cc88f8-1aad-427e-a0bf-115e94fcb115","value":{"statusBar":84}}
[5b3e818a]-[AndroidUiautomator2Driver@e302] Got response with status 200: {"sessionId":"45cc88f8-1aad-427e-a0bf-115e94fcb115","value":{"height":2408,"width":1080}}
[5b3e818a]-[AndroidUiautomator2Driver@e302] Got response with status 200: {"sessionId":"45cc88f8-1aad-427e-a0bf-115e94fcb115","value":{"androidId":"fcbb6f4cb7f6fafb","apiVersion":"30","bluetooth":{"state":"ON"},"brand":"vivo","carrierName":"","displayDensity":480,"locale":"zh_CN","manufacturer":"vivo","model":"V2156A","networks":[{"capabilities":{"SSID":null,"linkDownBandwidthKbps":113000,"linkUpstreamBandwidthKbps":113000,"networkCapabilities":"NET_CAPABILITY_NOT_METERED,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_VALIDATED,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_FOREGROUND,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED","signalStrength":-63,"transportTypes":"TRANSPORT_WIFI"},"detailedState":"CONNECTED","extraInfo":"\"Tencent-WiFi\"","isAvailable":true,"isConnected":true,"isFailover":false,"isRoaming":false,"state":"CONNECTED","subtype":0,"subtypeName":"","type":1,"typeName":"WIFI"},{"capabilities":{"SSID":null,"linkDownBandwidthKbps":113000,"linkUpstreamBandwidthKbps":113000,"networkCapabilitie...
[5b3e818a]-[AndroidUiautomator2Driver@e302] Screen already unlocked, doing nothing
[5b3e818a][AppiumDriver@4077] New AndroidUiautomator2Driver session created successfully, session 5b3e818a-91ec-49b8-bd2b-08e415fc6157 added to master session list
[5b3e818a][AppiumDriver@4077] Event 'newSessionStarted' logged at 1747050390768 (19:46:30 GMT+0800 (China Standard Time))
[5b3e818a]-[AndroidUiautomator2Driver@e302] Cached the protocol value 'W3C' for the new session 5b3e818a-91ec-49b8-bd2b-08e415fc6157
[5b3e818a]-[AndroidUiautomator2Driver@e302] Responding to client with driver.createSession() result: {"capabilities":{"platformName":"Android","browserName":"MSEdge","automationName":"UiAutomator2","deviceName":"3405331233000MD","edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","showChromedriverLog":true,"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","browserName":"MSEdge","automationName":"UiAutomator2","deviceName":"3405331233000MD","edgeDriverPath":"/Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver","showChromedriverLog":true},"deviceUDID":"3405331233000MD","pixelRatio":"3","statBarHeight":84,"viewportRect":{"left":0,"top":84,"width":1080,"height":2324},"deviceApiLevel":30,"platformVersion":"11","deviceManufacturer":"vivo","deviceModel":"V2156A","deviceScreenSize":"1080x2408","deviceScreenDensity":480}}
[5b3e818a][HTTP] <-- POST /session 200 3909 ms - 1037 
[5b3e818a][HTTP] --> POST /session/5b3e818a-91ec-49b8-bd2b-08e415fc6157/url {"url":"https://www.okx.com/zh-hans-sg/account/login"}
[5b3e818a]-[AndroidUiautomator2Driver@e302] Calling AppiumDriver.setUrl() with args: ["https://www.okx.com/zh-hans-sg/account/login","5b3e818a-91ec-49b8-bd2b-08e415fc6157"]
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell am start -W -a android.intent.action.VIEW -d https://www.okx.com/zh-hans-sg/account/login'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Responding to client with driver.setUrl() result: null
[5b3e818a][HTTP] <-- POST /session/5b3e818a-91ec-49b8-bd2b-08e415fc6157/url 200 157 ms - 14 
[5b3e818a][HTTP] --> DELETE /session/5b3e818a-91ec-49b8-bd2b-08e415fc6157 {}
[5b3e818a]-[AndroidUiautomator2Driver@e302] Calling AppiumDriver.deleteSession() with args: ["5b3e818a-91ec-49b8-bd2b-08e415fc6157"]
[5b3e818a][AppiumDriver@4077] Event 'quitSessionRequested' logged at 1747050393944 (19:46:33 GMT+0800 (China Standard Time))
[5b3e818a][AppiumDriver@4077] Removing session 5b3e818a-91ec-49b8-bd2b-08e415fc6157 from our master session list
[5b3e818a]-[AndroidUiautomator2Driver@e302] Deleting UiAutomator2 session
[5b3e818a]-[AndroidUiautomator2Driver@e302] Deleting UiAutomator2 server session
[5b3e818a]-[AndroidUiautomator2Driver@e302] Proxying [DELETE /] to [DELETE http://127.0.0.1:8200/session/45cc88f8-1aad-427e-a0bf-115e94fcb115] with no body
[5b3e818a]-[AndroidUiautomator2Driver@e302] Got response with status 200: {"sessionId":"45cc88f8-1aad-427e-a0bf-115e94fcb115","value":null}
[5b3e818a][ADB] Getting IDs of all 'io.appium.uiautomator2.server' processes
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell 'pgrep --help; echo $?''
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell pgrep -f \(\[\[:blank:\]\]\|\^\)io\.appium\.uiautomator2\.server\(:\[a-zA-Z0-9_-\]\+\)\?\(\[\[:blank:\]\]\|\$\)'
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:.
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] 
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] Time: 4.544
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] 
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] OK (1 test)
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] 
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] 
[5b3e818a]-[AndroidUiautomator2Driver@e302] [Instrumentation] The process has exited with code null, signal SIGTERM
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell am force-stop io.appium.uiautomator2.server'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell am force-stop io.appium.uiautomator2.server.test'
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell dumpsys activity services io.appium.settings/.recorder.RecorderService'
[5b3e818a][ADB] Removing forwarded port socket connection: 8200 
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD forward --remove tcp:8200'
[5b3e818a]-[AndroidUiautomator2Driver@e302] Restoring hidden api policy to the device default configuration
[5b3e818a][ADB] Running '/Users/stanleyhong/Library/Android/sdk/platform-tools/adb -P 5037 -s 3405331233000MD shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''
[5b3e818a][Logcat] Stopping logcat capture
[5b3e818a][AppiumDriver@4077] Event 'quitSessionFinished' logged at 1747050394243 (19:46:34 GMT+0800 (China Standard Time))
[5b3e818a][AppiumDriver@4077] Received response: null
[5b3e818a][AppiumDriver@4077] But deleting session, so not returning
[5b3e818a][AppiumDriver@4077] Responding to client with driver.deleteSession() result: null
[5b3e818a][HTTP] <-- DELETE /session/5b3e818a-91ec-49b8-bd2b-08e415fc6157 200 303 ms - 14 

By the way, the Edge App version:

And the msedgedriver version:

➜  ~ /Users/stanleyhong/Desktop/myfiles/edgedriver_mac64_136.0.3240.50/msedgedriver --version
Microsoft Edge WebDriver 136.0.3240.64 (e3a39d3fa3c676e37c63636a4f502cdb15384392)

According to this:

You should be able to run with html driver:

In the server log I don’t observe the code trying to switch to web view mode.
Try to explicitly call setContext API after session startup.

mmmm looks like something wrong here?