question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't make Fetch API work

See original GitHub issue

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 error ReferenceError: "fetch" is not defined. On the code like window.fetch(request) it fails with TypeError: 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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
rbricommented, Mar 11, 2022

since 2.59 there is finally a workaround based on the polyfill support - check out https://htmlunit.sourceforge.io/webclient.html

1reaction
rbicommented, Jun 18, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Can't fetch data with fetch API - Stack Overflow
Can't fetch data with fetch API ... I can't get the fetch() API to work. I get the strong feeling I'm doing something...
Read more >
How to Use the Fetch API (Correctly) - CODE Magazine
Navigate into the folder Samples-WebAPI and load that folder in Visual Studio Code or Visual Studio 2019. Open the appsettings.json file and ...
Read more >
Using the Fetch API - MDN Web Docs
The Fetch API provides a JavaScript interface for accessing and manipulating parts of the protocol, such as requests and responses.
Read more >
Why I won't be using Fetch API in my apps - Shahar Talmi
When Fetch API became standard I was thrilled. I will no longer need to use http utility libraries in order to make http...
Read more >
Fetch API - The Modern JavaScript Tutorial
Still, it's good to know what fetch can do, so if the need arises, ... will succeed due to keepalive , but subsequent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found