-
-
Notifications
You must be signed in to change notification settings - Fork 176
Can't make Fetch API work #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The fetch api is not supported so far - any help is welcome. |
… import tests pass under htmlunit. Workaround for HtmlUnit/htmlunit#78 Part of #1072
@rbi Any update? Any workaround? Thanks in advance
|
@mvillafuertem maybe you meant @rbri instead of @rbi ? But as a coincidence I faced the same issue. I solved it by using a Polyfill that implements the fetch API based on XMLHttpRequest in the software under test. |
Perhaps a dumb question, but would it make sense to support JS polyfills directly in HtmlUnit to support features like fetch? |
@niloc132 that sounds like a really good idea - i will experiment a bit with that. |
A patch showing how would make a great example for how to contribute other such features - I'm actually a bit surprised that other JS APIs havent been implemented with this before, leverage the rest of the engine working so well. If you could also show very roughly how you would envision this working, I'd be happy to take a crack at this fix myself. |
@niloc132 can you please open a separate issue for using a polyfill |
@niloc132 - short progress update - i'm just made the first fetch request working based on your idea!!!! |
since 2.59 there is finally a workaround based on the polyfill support - check out https://htmlunit.sourceforge.io/webclient.html |
As far as I understand, Fetch API is supported but I couldn't make it working.
On the code like
fetch(request)...
I got an errorReferenceError: "fetch" is not defined
.On the code like
window.fetch(request)
it fails withTypeError: Cannot find function fetch in object [object Window]
I use 2.36.0 version with htmlunit-driver and RobotFramework. The code for creating htmlunit driver is the following:
https://github.com/Hi-Fi/robotframework-seleniumlibrary-java/blob/fed6f0e95b5cf5a365f8357a9976ec9ed7ff7e1e/src/main/java/com/github/markusbernhardt/seleniumlibrary/keywords/BrowserManagement.java#L782-L785
I expect that it will use default browser that is CHROME and it should have a support for Fetch API.
The text was updated successfully, but these errors were encountered: