Katalon Should Support All URL Schemes and Protocols
I thought hard about whether to post this as a bug or as a suggestion. The problem with “suggestion” is it implies it can be declined or even ignored. And since this is a failing in terms of Katalon’s ability to automate a browser, it seems valid to call it what it is: a bug.
Data URLs are a thing. Katalon does not support them. Katalon should support them.
But Katalon stops with an error and note that the failure occurs in Java/Groovy code, not the webdriver:
Unable to navigate to 'data:text/html;charset=utf-8,<div>Katalon</div>'
(Root cause: com.kms.katalon.core.exception.StepFailedException:
Unable to navigate to 'data:text/html;charset=utf-8,<div>Katalon</div>'
--snip--
at TempTestCase1556024744947.run(TempTestCase1556024744947.groovy:21)
Caused by: java.nio.file.InvalidPathException:
Illegal char <:> at index 4: data:text/html;charset=utf-8,<div>Katalon</div>
That’s hard to answer properly - they can be used for many things. Perhaps most commonly images? But as my little demo shows, they’re fully supported directly in the address bar, too.
There’s more discussion below (not quite sure why we ended up with two reports )
Side Note: I would fully understand if the devs decide this is too niche a requirement. But the fact remains, Data URIs are legal and Katalon fails to support them in any form.
Using callTestCase(), I developed something called a Super Test Case or Suite-Test-Case (STCs). They are a means to run something like a suite without some of the baggage of suites (mostly avoiding conventional reporting) plus provide a way to control the context around all the member Test Cases (you can specify things like before-tc to ensure a preparatory TC is executed before a given TC.
STCs are of course meant for Test development purposes and perhaps less useful for published suite-type purposes.
Here’s a screenshot of some of my notes on the topic.
To complete the story, I wanted to output the STC report directly in the browser. A Groovy string would be used to store the HTML for the report and passed to the browser as a data URI.
Because Data URIs are not supported, I had to write the string to a file and then navigate to it using a file: schema. That works but it’s a messier way to do such a simple thing. (Plus the files need to be cleaned up at some point.)
So, again, you might consider that to be a niche requirement but since it’s useful for a TC developer, there’s every chance it could be re-purposed as a plugin (I’d probably pass it over to @kazurayam to do that - I’m not an Eclipse/Java guy as we all know )
The toFileURL keyword method of DataURL class will do “write the to a temporary file and return an instance of java.net.URL with file: schema which points to the temporary file”.
Are you satisfied if the keyword supports only the MIME TYPE text/html?Do you require other MIME TYPES such as image/png and video/mp4?
This experiment showed me that the Selenium WebDriver API supports data: URI with no problem. On the other hand, Katalon’s WebUI API mis-interprets a data: URI to be a file: URL.
Therefore, I have got 2 points.
If you bother yourself to call WebDriver API in your Test Case, you can use data: URI now.