Selenuim with Firefox – difficulties handling JSONs

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 :

  1. Type about:config in the Firefox address bar and hit the Enter-key.
  2. Confirm that you will be careful if the warning prompt appears.
  3. Search for devtools.jsonview.enabled.
  4. Double-click on the preference name and disable it.


Another quick fix:

Simply add your attempted to scarp url: “view-source:”

for example:

instead of use : view-source: ,And that should do the trick

Leave a Reply

Your email address will not be published. Required fields are marked *