htmlunit-driver icon indicating copy to clipboard operation
htmlunit-driver copied to clipboard

Unable to open html file using disk path

Open skyhirider opened this issue 8 months ago • 3 comments

When I call

driver.get("C:\\Users\\User\\Path\\HtmlUnit-tests\\src\\test\\resources\\scrollTable.html");

I get

java.io.IOException: Unable to create URI from URL: c:\Users\User\Path\HtmlUnit-tests\src\test\resources\scrollTable.html (reason: Illegal character in path at index 5: c:///\Users\User\Path\HtmlUnit-tests\src\test\resources\scrollTable.html)

Running on Windows.

The Firefox driver can open this path without issues.

skyhirider avatar Mar 30 '25 08:03 skyhirider

@skyhirider thanks for reporting this, i can reproduce this but i have to think a bit about a possible fix

rbri avatar Mar 30 '25 09:03 rbri

as a workaround you can use the file: protocol

rbri avatar Mar 30 '25 10:03 rbri

Thanks, the workaround does work

driver.get("file://C:\\Users\\User\\Path\\HtmlUnit-tests\\src\\test\\resources\\scrollTable.html")

skyhirider avatar Mar 30 '25 10:03 skyhirider