Python+uiautomator2: URI and package arguments are required

Hi, I’m new to appium but I have already some experiences with Selenium. I’m trying to use Appium to test mobile browsers. I’ve followed the installation instructions (I’m using Linux as the host) and I have installed android studio as well. Since the python example in the tutorial does not work (getting the battery app) and because I’m more interested in testing web app, I modified the example code in order to open a web page.
Unfortunately, it does not work neither :frowning:
Here my current code:

import pytest
from appium import webdriver
# Options are available in Python client since v2.6.0
from appium.options.android import UiAutomator2Options

def generate_options():
    common_caps = {
        'appium:avd': 'Pixel_3a_API_34_extension_level_7_x86_64',
    }
    chrome_options = UiAutomator2Options().load_capabilities(common_caps)
    chrome_options.browserName = 'chrome'
    return [chrome_options]

@pytest.fixture(params=generate_options())
def driver(request):
    # The default URL is http://127.0.0.1:4723/wd/hub in Appium1
    drv = webdriver.Remote('http://localhost:4723', options=request.param)
    yield drv
    drv.quit()

def test_foo(driver):
    driver.get('https://webkit.org/status')

Any idea how to use the uiautomator2 driver in Python to test a webpage ?

For information:
$ node --version
v20.8.0
$ npm --version
10.2.0
And appium output:

[Appium] Welcome to Appium v2.1.3
[Appium] Attempting to load driver chromium...
[debug] [Appium] Requiring driver at /home/johan/.appium/node_modules/appium-chromium-driver
[Appium] Attempting to load driver gecko...
[debug] [Appium] Requiring driver at /home/johan/.appium/node_modules/appium-geckodriver
[Appium] Attempting to load driver uiautomator2...
[debug] [Appium] Requiring driver at /home/johan/.appium/node_modules/appium-uiautomator2-driver
[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:
[Appium] 	http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] 	http://192.168.0.65:4723/
[Appium] Available drivers:
[Appium]   - [email protected] (automationName 'Chromium')
[Appium]   - [email protected] (automationName 'Gecko')
[Appium]   - [email protected] (automationName 'UiAutomator2')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
[debug] [HTTP] Request idempotency key: 028be834-e7d4-4246-81bb-11ce5dda8d45
[HTTP] --> POST /session
[HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"UIAutomator2","platformName":"Android","appium:avd":"Pixel_3a_API_34_extension_level_7_x86_64"}}}
[debug] [AppiumDriver@890a] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"UIAutomator2","platformName":"Android","appium:avd":"Pixel_3a_API_34_extension_level_7_x86_64"}}]
[debug] [AppiumDriver@890a] Event 'newSessionRequested' logged at 1697446044993 (10:47:24 GMT+0200 (Central European Summer 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 /home/johan/.appium/node_modules/appium-uiautomator2-driver
[debug] [Appium] Requiring driver at /home/johan/.appium/node_modules/appium-uiautomator2-driver
[AppiumDriver@890a] Appium v2.1.3 creating new AndroidUiautomator2Driver (v2.29.11) session
[AppiumDriver@890a] Checking BaseDriver versions for Appium and AndroidUiautomator2Driver
[AppiumDriver@890a] Appium's BaseDriver version is 9.3.20
[AppiumDriver@890a] AndroidUiautomator2Driver's BaseDriver version is 9.3.20
[debug] [AndroidUiautomator2Driver@ebb0] Creating session with W3C capabilities: {
[debug] [AndroidUiautomator2Driver@ebb0]   "alwaysMatch": {
[debug] [AndroidUiautomator2Driver@ebb0]     "platformName": "Android",
[debug] [AndroidUiautomator2Driver@ebb0]     "appium:automationName": "UIAutomator2",
[debug] [AndroidUiautomator2Driver@ebb0]     "appium:avd": "Pixel_3a_API_34_extension_level_7_x86_64"
[debug] [AndroidUiautomator2Driver@ebb0]   },
[debug] [AndroidUiautomator2Driver@ebb0]   "firstMatch": [
[debug] [AndroidUiautomator2Driver@ebb0]     {}
[debug] [AndroidUiautomator2Driver@ebb0]   ]
[debug] [AndroidUiautomator2Driver@ebb0] }
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Session created with session id: 8012c2b2-bf38-439a-9a7c-6c9d80e63314
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Neither 'app' nor 'appPackage' was set. Starting UiAutomator2 without the target application
[ADB] Found 1 'build-tools' folders under '/home/johan/Android/Sdk' (newest first):
[ADB]     /home/johan/Android/Sdk/build-tools/34.0.0
[ADB] Using 'adb' from '/home/johan/Android/Sdk/platform-tools/adb'
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 start-server'
[debug] [ADB] Trying to find 'Pixel_3a_API_34_extension_level_7_x86_64' emulator
[debug] [ADB] Getting connected emulators
[debug] [ADB] Getting connected devices
[debug] [ADB] Connected devices: [{"udid":"emulator-5554","state":"device"}]
[debug] [ADB] 1 emulator connected
[debug] [ADB] Overriding /home/johan/.emulator_console_auth_token with an empty string to avoid telnet authentication for emulator commands
[debug] [ADB] Executing Emulator console command: avd name
[debug] [ADB] Found emulator 'Pixel_3a_API_34_extension_level_7_x86_64' on port 5554
[debug] [ADB] Setting device id to emulator-5554
[debug] [AndroidDriver] Not launching AVD because it is already running.
[AndroidDriver] Using device: emulator-5554
[ADB] Using 'adb' from '/home/johan/Android/Sdk/platform-tools/adb'
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 start-server'
[debug] [ADB] Setting device id to emulator-5554
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 34
[ADB] Getting device platform version
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 14
[debug] [ADB] Device API level: 34
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Relaxing hidden api policy
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 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''
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device'
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell echo ping'
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting package info for 'io.appium.settings'
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[debug] [ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('5.1.2' >= '5.1.2')
[debug] [ADB] There is no need to install/upgrade '/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pgrep -f \(\[\[:blank:\]\]\|\^\)io\.appium\.settings\(\[\[:blank:\]\]\|\$\)'
[debug] [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[debug] [Logcat] Starting logs capture with command: /home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 logcat -v threadtime
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Forwarding UiAutomator2 Server port 6790 to local port 8200
[debug] [ADB] Forwarding system: 8200 to device: 6790
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp:8200 tcp:6790'
[debug] [ADB] Checking app cert for /home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v5.12.6.apk
[debug] [ADB] Checking app cert for /home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk
[ADB] Using 'apksigner.jar' from '/home/johan/Android/Sdk/build-tools/34.0.0/lib/apksigner.jar'
[debug] [ADB] Starting apksigner: /usr/lib/jvm/default-java/bin/java -Xmx1024M -Xss1m -jar /home/johan/Android/Sdk/build-tools/34.0.0/lib/apksigner.jar verify --print-certs /home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk
[debug] [ADB] Starting apksigner: /usr/lib/jvm/default-java/bin/java -Xmx1024M -Xss1m -jar /home/johan/Android/Sdk/build-tools/34.0.0/lib/apksigner.jar verify --print-certs /home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v5.12.6.apk
[debug] [ADB] apksigner stdout: Signer #1 certificate DN: [email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[debug] [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[debug] [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[debug] [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[debug] [ADB] 
[debug] [ADB] sha256 hash did match for 'appium-uiautomator2-server-debug-androidTest.apk'
[ADB] '/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk' is signed with the default certificate
[debug] [ADB] Getting install status for io.appium.uiautomator2.server.test
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm path io.appium.uiautomator2.server.test'
[debug] [ADB] 'io.appium.uiautomator2.server.test' is installed
[debug] [ADB] apksigner stdout: Signer #1 certificate DN: [email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[debug] [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[debug] [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[debug] [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[debug] [ADB] 
[debug] [ADB] sha256 hash did match for 'appium-uiautomator2-server-v5.12.6.apk'
[ADB] '/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v5.12.6.apk' is signed with the default certificate
[debug] [ADB] Getting package info for 'io.appium.uiautomator2.server'
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[debug] [ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('5.12.6' >= '5.12.6')
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Server packages status: [{"wasSigned":true,"installState":"sameVersionInstalled","appPath":"/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v5.12.6.apk","appId":"io.appium.uiautomator2.server"},{"wasSigned":true,"installState":"sameVersionInstalled","appPath":"/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk","appId":"io.appium.uiautomator2.server.test"}]
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Server packages are not going to be (re)installed
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Waiting up to 30000ms for services to be available
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list instrumentation'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[ADB] Adding packages ["io.appium.settings","io.appium.uiautomator2.server","io.appium.uiautomator2.server.test"] to Doze whitelist
[debug] [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",";"]]
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] No app capability. Assuming it is already on the device
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Performing shallow cleanup of automation leftovers
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] No obsolete sessions have been detected (socket hang up)
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test'
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Starting UIAutomator2 server 5.12.6
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Using UIAutomator2 server from '/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v5.12.6.apk' and test from '/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Waiting up to 30000ms for UiAutomator2 to be online...
[debug] [ADB] Creating ADB subprocess with args: ["-P","5037","-s","emulator-5554","shell","am","instrument","-w","-e","disableAnalytics",true,"io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/status' to command name 'getStatus'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /status] to [GET http://127.0.0.1:8200/status] with no body
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] socket hang up
[debug] [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/status' to command name 'getStatus'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /status] to [GET http://127.0.0.1:8200/status] with no body
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] socket hang up
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/status' to command name 'getStatus'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /status] to [GET http://127.0.0.1:8200/status] with no body
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] socket hang up
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/status' to command name 'getStatus'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /status] to [GET http://127.0.0.1:8200/status] with no body
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] The initialization of the instrumentation process took 3070ms
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/session' to command name 'createSession'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [POST /session] to [POST http://127.0.0.1:8200/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"UIAutomator2","avd":"Pixel_3a_API_34_extension_level_7_x86_64"},"platformName":"Android","automationName":"UIAutomator2","avd":"Pixel_3a_API_34_extension_level_7_x86_64","deviceName":"emulator-5554","deviceUDID":"emulator-5554"}],"alwaysMatch":{}}}
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Got response with status 200: {"sessionId":"5ac1eb62-c370-41ba-b34c-d38040f0e48f","value":{"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"UIAutomator2","avd":"Pixel_3a_API_34_extension_level_7_x86_64"},"platformName":"Android","automationName":"UIAutomator2","avd":"Pixel_3a_API_34_extension_level_7_x86_64","deviceName":"emulator-5554","deviceUDID":"emulator-5554"}],"alwaysMatch":{}},"sessionId":"5ac1eb62-c370-41ba-b34c-d38040f0e48f"}}
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Determined the downstream protocol as 'W3C'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8200/session/5ac1eb62-c370-41ba-b34c-d38040f0e48f/appium/device/info] with no body
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Got response with status 200: {"sessionId":"5ac1eb62-c370-41ba-b34c-d38040f0e48f","value":{"androidId":"adaf232bffcb2f89","apiVersion":"34","bluetooth":{"state":"ON"},"brand":"google","carrierName":"T-Mobile","displayDensity":440,"locale":"en_US","manufacturer":"Google","model":"sdk_gphone64_x86_64","networks":[{"capabilities":{"SSID":null,"linkDownBandwidthKbps":4300,"linkUpstreamBandwidthKbps":1800,"networkCapabilities":"NET_CAPABILITY_MMS,NET_CAPABILITY_SUPL,NET_CAPABILITY_DUN,NET_CAPABILITY_FOTA,NET_CAPABILITY_IMS,NET_CAPABILITY_CBS,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_VALIDATED,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED","signalStrength":-2147483648,"transportTypes":"TRANSPORT_CELLULAR"},"detailedState":"CONNECTED","extraInfo":"epc.tmobile.com","isAvailable":true,"isConnected":true,"isFailover":false,"isRoaming":false,"state":"CONNECTED","subtype":10,"subtypeName":"HSPA","type":0,"typeName":"MOBILE"},{"capabiliti...
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /appium/device/pixel_ratio] to [GET http://127.0.0.1:8200/session/5ac1eb62-c370-41ba-b34c-d38040f0e48f/appium/device/pixel_ratio] with no body
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Got response with status 200: {"sessionId":"5ac1eb62-c370-41ba-b34c-d38040f0e48f","value":2.75}
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/appium/device/system_bars' to command name 'getSystemBars'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /appium/device/system_bars] to [GET http://127.0.0.1:8200/session/5ac1eb62-c370-41ba-b34c-d38040f0e48f/appium/device/system_bars] with no body
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Got response with status 200: {"sessionId":"5ac1eb62-c370-41ba-b34c-d38040f0e48f","value":{"statusBar":66}}
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/window/current/size' to command name 'getWindowSize'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [GET /window/current/size] to [GET http://127.0.0.1:8200/session/5ac1eb62-c370-41ba-b34c-d38040f0e48f/window/current/size] with no body
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Got response with status 200: {"sessionId":"5ac1eb62-c370-41ba-b34c-d38040f0e48f","value":{"height":2154,"width":1080}}
[AppiumDriver@890a] New AndroidUiautomator2Driver session created successfully, session 8012c2b2-bf38-439a-9a7c-6c9d80e63314 added to master session list
[debug] [AppiumDriver@890a] Event 'newSessionStarted' logged at 1697446049854 (10:47:29 GMT+0200 (Central European Summer Time))
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Cached the protocol value 'W3C' for the new session 8012c2b2-bf38-439a-9a7c-6c9d80e63314
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Responding to client with driver.createSession() result: {"capabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"UIAutomator2","avd":"Pixel_3a_API_34_extension_level_7_x86_64"},"platformName":"Android","automationName":"UIAutomator2","avd":"Pixel_3a_API_34_extension_level_7_x86_64","deviceName":"emulator-5554","deviceUDID":"emulator-5554","deviceApiLevel":34,"platformVersion":"14","deviceScreenSize":"1080x2220","deviceScreenDensity":440,"deviceModel":"sdk_gphone64_x86_64","deviceManufacturer":"Google","pixelRatio":2.75,"statBarHeight":66,"viewportRect":{"left":0,"top":66,"width":1080,"height":2088}}}
[HTTP] <-- POST /session 200 4865 ms - 820
[HTTP] 
[HTTP] --> POST /session/8012c2b2-bf38-439a-9a7c-6c9d80e63314/url
[HTTP] {"url":"https://webkit.org/status"}
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Calling AppiumDriver.setUrl() with args: ["https://webkit.org/status","8012c2b2-bf38-439a-9a7c-6c9d80e63314"]
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Encountered internal error running command: Error: URI and package arguments are required
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at ADB.startUri (/home/johan/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-adb/lib/tools/apk-utils.js:69:11)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at AndroidUiautomator2Driver.commands.setUrl (/home/johan/.appium/node_modules/appium-uiautomator2-driver/lib/commands/general.js:206:18)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at commandExecutor (/home/johan/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/driver.ts:107:18)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at /home/johan/lib/node_modules/appium/node_modules/async-lock/lib/index.js:171:12
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at AsyncLock._promiseTry (/home/johan/lib/node_modules/appium/node_modules/async-lock/lib/index.js:304:31)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at exec (/home/johan/lib/node_modules/appium/node_modules/async-lock/lib/index.js:170:9)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at AsyncLock.acquire (/home/johan/lib/node_modules/appium/node_modules/async-lock/lib/index.js:187:3)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at AndroidUiautomator2Driver.executeCommand (/home/johan/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/driver.ts:123:39)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at defaultBehavior (/home/johan/lib/node_modules/appium/lib/appium.js:722:14)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at AppiumDriver.executeWrappedCommand (/home/johan/lib/node_modules/appium/lib/appium.js:828:16)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at AppiumDriver.executeCommand (/home/johan/lib/node_modules/appium/lib/appium.js:734:17)
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)]     at asyncHandler (/home/johan/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:393:19)
[HTTP] <-- POST /session/8012c2b2-bf38-439a-9a7c-6c9d80e63314/url 500 25 ms - 578
[HTTP] 
[HTTP] --> DELETE /session/8012c2b2-bf38-439a-9a7c-6c9d80e63314
[HTTP] {}
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Calling AppiumDriver.deleteSession() with args: ["8012c2b2-bf38-439a-9a7c-6c9d80e63314"]
[debug] [AppiumDriver@890a] Event 'quitSessionRequested' logged at 1697446049925 (10:47:29 GMT+0200 (Central European Summer Time))
[AppiumDriver@890a] Removing session 8012c2b2-bf38-439a-9a7c-6c9d80e63314 from our master session list
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Deleting UiAutomator2 session
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Deleting UiAutomator2 server session
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Matched '/' to command name 'deleteSession'
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Proxying [DELETE /] to [DELETE http://127.0.0.1:8200/session/5ac1eb62-c370-41ba-b34c-d38040f0e48f] with no body
[debug] [AndroidUiautomator2Driver@ebb0 (8012c2b2)] Got response with status 200: {"sessionId":"5ac1eb62-c370-41ba-b34c-d38040f0e48f","value":null}
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys activity services io.appium.settings/.recorder.RecorderService'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8200 
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp:8200'
[AndroidUiautomator2Driver@ebb0 (8012c2b2)] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running '/home/johan/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''
[debug] [AppiumDriver@890a] Event 'quitSessionFinished' logged at 1697446049991 (10:47:29 GMT+0200 (Central European Summer Time))
[debug] [AppiumDriver@890a] Received response: null
[debug] [AppiumDriver@890a] But deleting session, so not returning
[debug] [AppiumDriver@890a] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /session/8012c2b2-bf38-439a-9a7c-6c9d80e63314 200 68 ms - 14
[HTTP] 
[debug] [Instrumentation] .
[debug] [Instrumentation] Time: 3.045
[debug] [Instrumentation] 
[debug] [Instrumentation] OK (1 test)
[debug] [Instrumentation] The process has exited with code 0

Either update the python client to the most recent version or put the browserName into common_caps as a workaround