appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.19k stars 752 forks source link

startLogcatBroadcast does not respect https #2181

Open janmekota opened 3 weeks ago

janmekota commented 3 weeks ago

Description

Bug. The Appium is accessible over HTTPS.

curl https://<user>:<pass>@<host>:8443/status
{"value":{"ready":true,"message":"The server is ready to accept new connections","build":{"version":"2.1.3"}}}

The tests are triggered with java property -Dappium.hub=https://user:pass@host:8443.

When we call startLogcatBroadcast: androidDriver.startLogcatBroadcast(androidDriver.getRemoteAddress().getHost(), androidDriver.getRemoteAddress().getPort()); We get error:

org.openqa.selenium.remote.http.ConnectionFailedException: JdkWebSocket initial request execution error
Build info: version: '4.21.0', revision: '79ed462ef4'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '14.5', java.version: '17.0.7'
Driver info: driver.version: unknown
Caused by: java.net.http.WebSocketHandshakeException
Caused by: jdk.internal.net.http.websocket.CheckFailedException: Unexpected HTTP response status code 404
    ... 11 more
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
org.openqa.selenium.remote.http.jdk.JdkHttpClient.openSocket(JdkHttpClient.java:240)
io.appium.java_client.ws.StringWebSocketClient.connect(StringWebSocketClient.java:74)
io.appium.java_client.android.ListensToLogcatMessages.startLogcatBroadcast(ListensToLogcatMessages.java:67)

URI: http://host:8443/ws/session/b515a27e-ff21-4e43-b8f2-b336eed55665/appium/device/logcat

Here the endpointUri is set to ws:// regardless -Dappium.hub=https://. The wss:// should be used.

Environment