Appium - "Url or Uri must start with <scheme>://*" for flutter app

Receiving “Url or Uri must start with ://*” error, it started all of a sudden and due to this error execution stops most of the time before launching the test.

These are the capabilities passed:

Attaching logs

(setUpAll) [E]
UnknownException (500): An unknown server-side error occurred while processing the command. Original error: Url or Uri must start with ://
package:webdriver/src/handler/w3c/utils.dart 99:9 parseW3cResponse
package:appium_driver/src/handler/w3c/navigation.dart 13:5 W3cNavigationHandler.parseNavigateToResponse
package:webdriver/src/common/request_client.dart 96:32 AsyncRequestClient.send
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
package:appium_driver/src/async/web_driver.dart 66:55 AppiumWebDriver.get
test\login.dart 35:32 main.
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
test\login.dart main.

This test failed after it had already completed. Make sure to use [expectAsync]
or the [completes] matcher when testing async code.
package:webdriver/src/handler/w3c/utils.dart 99:9 parseW3cResponse
package:appium_driver/src/handler/w3c/navigation.dart 13:5 W3cNavigationHandler.parseNavigateToResponse
package:webdriver/src/common/request_client.dart 96:32 AsyncRequestClient.send
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
package:appium_driver/src/async/web_driver.dart 66:55 AppiumWebDriver.get
test\login.dart 35:32 main.
===== asynchronous gap ===========================
dart:async _asyncThenWrapperHelper
test\login.dart

Appium server logs:
[HTTP]
[HTTP] --> POST /wd/hub/session/66d512de-d3f6-49d9-a08f-adea32878d5e/url
[HTTP] {“url”:"/sessionXXX"}
[W3C (66d512de)] Encountered internal error running command: Error: Url or Uri must start with ://
[W3C (66d512de)] at Object.setUrl (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\validators.js:17:13)
[W3C (66d512de)] at asyncHandler (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:288:9)
[W3C (66d512de)] at C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:423:15
[W3C (66d512de)] at Layer.handle [as handle_request] (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[W3C (66d512de)] at next (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\route.js:137:13)
[W3C (66d512de)] at Route.dispatch (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\route.js:112:3)
[W3C (66d512de)] at Layer.handle [as handle_request] (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[W3C (66d512de)] at C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:281:22
[W3C (66d512de)] at param (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:354:14)
[W3C (66d512de)] at param (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:365:14)
[W3C (66d512de)] at Function.process_params (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:410:3)
[W3C (66d512de)] at next (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
[W3C (66d512de)] at logger (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\morgan\index.js:144:5)
[W3C (66d512de)] at Layer.handle [as handle_request] (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[W3C (66d512de)] at trim_prefix (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:317:13)
[W3C (66d512de)] at C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:284:7
[W3C (66d512de)] at Function.process_params (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:335:12)
[W3C (66d512de)] at next (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
[W3C (66d512de)] at C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\body-parser\lib\read.js:130:5
[W3C (66d512de)] at invokeCallback (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\raw-body\index.js:224:16)
[W3C (66d512de)] at done (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\raw-body\index.js:213:7)
[W3C (66d512de)] at IncomingMessage.onEnd (C:\Users\aksha\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\raw-body\index.js:273:7)
[W3C (66d512de)] at IncomingMessage.emit (events.js:322:22)
[W3C (66d512de)] at endReadableNT (_stream_readable.js:1187:12)
[W3C (66d512de)] at processTicksAndRejections (internal/process/task_queues.js:84:21)
[HTTP] <-- POST /wd/hub/session/66d512de-d3f6-49d9-a08f-adea32878d5e/url 500 9 ms - 4337
[HTTP]

Can someone help me on how to resolve this

Also few times receiving ‘io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 3f1a6d44-b90c-48ce-9cad-57dd91986ba7 is not known’

Usually works after restarting appium server a few times, but now stuck in the same and doesn’t work after restarting server

Encountered internal error running command: io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 3f1a6d44-b90c-48ce-9cad-57dd91986ba7 is not known

[W3C] at io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:54)

[W3C] at io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:266)

[W3C] at io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:260)

[W3C] at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)

[W3C] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)

[W3C] at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)

[W3C] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)

[W3C] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)

[W3C] at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)

[W3C] at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)

[W3C] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)

[W3C] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)

[W3C] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)

[W3C] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)

[W3C] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)

[W3C] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)

[W3C] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)

[W3C] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)

[W3C] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)

[W3C] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)

[W3C] at java.lang.Thread.run(Thread.java:1012)

[W3C]

[HTTP] <-- POST /wd/hub/session 404 32557 ms - 3692

[HTTP]

You appear to be missing capability appActivity:

@wreed I am still getting the same error - “Url or Uri must start with ://*” even after adding appActivity in capability

Also do let me know on about ‘io.appium.uiautomator2.common.exceptions.NoSuchDriverException: The session identified by 3f1a6d44-b90c-48ce-9cad-57dd91986ba7 is not known

This seems to be coming very often, but works after restarting appium a few items.

Oh, I hadn’t realized you were trying to run scripts against the GUI. You should try installing via NPM. Here is a tutorial:

https://appium.io/docs/en/about-appium/getting-started/index.html

I did installation using NPM, but doesn’t seem to resolve the issue. i.e. still get the error ‘Url or Uri must start with ://*’
But noticed that the app execution is not stopped as compared to before

Best way to share your log is with a git gist

@wreed
attaching the link below

Let me know how to resolve this as it seems to block me from moving forward.
Thanks in advance

First, thanks for posting the log as a gist. It really helps.

Second, to me it seems that the POST commands are not being proxied properly. @mykola-mokhnach can you take a look at this log? It almost looks like some kind of bug.

I do not observe any issues on the server side. The URL coming from the client is invalid, so the exception is expected:

[HTTP] → POST /wd/hub/session/62b477f1-663b-499c-9408-e6b5d41fdc7e/url
[HTTP] {“url”:“/sessionXXX”}

So is this a bug in the Flutter driver? Or something else? How would the user go about fixing this?

So is this a bug in the Flutter driver? Or something else?

To me it looks like a bug in the test script itself

How would the user go about fixing this?

Use debugger?

@mykola-mokhnach is it something wrong on the desired capabilities part?

on tests, I am not doing much as it fails on the setup itself.

I cannot help there, never used flutter driver myself

@wreed will some else be able to help me on this?

@Sarin_Suriyakoon do you have any comments on why I get this?
I got your name from an another similar suppor
t ticket

@AkshayS3 I think the best course of action from here is to file an issue with flutter driver:

I got it resolved, thanks