Unable to navigate to ‘data:text/html;charset=utf-8,
Katalon
’ (Root cause: java.nio.file.InvalidPathException: Illegal char <:> at index 4: data:text/html;charset=utf-8,
Katalon
)
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.
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
Hello!
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?
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.
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.