I’ve been trying to automatically fetch a json with selenium with firefox webdriver.
In some occasions the json was fetched completely fine, and in some strange cases json was fetched in a weird manner – not in a json format , but with some titles and the json content was encapsulated in an inner div.
After digging into this, I found out firefox had started using a json viewer by default. So in some cases when my script was fast enough it caught the original json, and when it hanged it got the json view html content.
A quick and simple solution :
- Type about:config in the Firefox address bar and hit the Enter-key.
- Confirm that you will be careful if the warning prompt appears.
- Search for devtools.jsonview.enabled.
- Double-click on the preference name and disable it.
Another quick fix:
Simply add your attempted to scarp url: “view-source:”
instead of https://httpbin.org/headers use : view-source:https://httpbin.org/headers ,And that should do the trick