URLs supplied to Katalon APIs MUST support data URIs

Example: the following should work:


But KS (java.nio) issues the following error:

Unable to navigate to ‘data:text/html;charset=utf-8,

’ (Root cause: java.nio.file.InvalidPathException: Illegal char <:> at index 4: data:text/html;charset=utf-8,

which is silly – a colon is certainly NOT an illegal character when part of a Scheme, otherwise http:, https: etc should fail also… goodbye the interwebz.

1 Like


I made the following test case:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
def uri = new URI('data:text/html;charset=utf-8,%3Cdiv%3EKatalon%3C%2Fdiv%3E')
WebUI.comment("URI successfully instanciated")
def url = new URL('data:text/html;charset=utf-8,%3Cdiv%3EKatalon%3C%2Fdiv%3E')
WebUI.comment("URL successfully instanciated")

When I run it, I got the following messages:

URI successfully instanciated
Test Cases/TC1 FAILED because (of) java.net.MalformedURLException: unknown protocol: data

This proves that the Java Language treats a String


as a valid URI, but not as a valid URL. What is the difference of a URI and a URI? — well, I am not willing to dive into this discussion.

I suppose WebUI.navigateToUrl(’…’) internally uses

def url = new URI(rawURL).toURL()

This is a Java idiom.

# Conclusion

you can’t use a data URI in Katalon Studio because of Java language design.

1 Like

Thanks for the deep dive, Kaz, and I suspect your conclusion is correct.

Even so, Katalon should (MUST) find a way to support a valid UR(I/L) and not allow something perfectly legal to be added to the “untestable” list.

Aside: IE does not support it. Chrome/FF do (didn’t try anything else).

‘Data URI’ or ‘Data URL’, which is correct? Even the MDN Documentation has a confusion.

The documents’ URL is
This URL string contains ‘Data URIs’.

However the document has a title ‘Data URLs’.

Interestingly the doc translated into Japanese has a title ‘Data URIs’.

Really messy.

Passed some time, but I have the same error and do not understand how to solve it.
I want to go to a url (protocol: data) data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAA… to take an image and receive the exception “java.net.MalformedURLException: unknown protocol: data”
Can you help me with something? or is there no solution for java?

As https://accu.org/index.php/journals/1434 explains,

Java is supplied with inbuilt support for a number of different schemes, as a minimum support for the following is guaranteed: http, https, ftp, file, and jar.

In other words Java is not supplied with in built support for data: scheme. Therefore you got a problem.

java.net.URL class has a number of constructors. One of them has an argument of type URLStreamHandler:

If you provide a concrete implementation of URLStreamHandler for data scheme, you would be able to construct an instance of java.net.URL of data: scheme.

But this explanation would not eventually solve your problem. You would want Katalon Studio to accept the instance of java.net.URL of ‘data’ which you (your test case script) instantiated. However Katalon Studio does not support such customizability.

So, you should not regard your problem is due to a shortage of Java language. You should rather raise a feature request for Katalon Studio. If you are willing to, you should describe your problem with more information (runnable codes at least) so that Katalon Team can understand what exactly is the point to be improved.


If you are still there, have a look at the following post: