How to get the raw page source?
<p>Consider a URL like <a href="https://groups.yahoo.com/api/v1/groups/concatenative/messages/300" rel="nofollow noreferrer">https://groups.yahoo.com/api/v1/groups/concatenative/messages/300</a> . This is an <code>application/json</code> response:</p>

<p><a href="https://i.stack.imgur.com/dtlpP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dtlpP.png" alt="enter image description here"></a></p>

<p>I'd like to access the JSON from Selenium. (I'm using Selenium because I need to access private groups and I didn't want to deal with figuring out how to login via mechanicalsoup or something of the sort.) However, getting the page source gives me <em>the way the browser is presenting the JSON</em>, not the JSON itself:</p>

<pre><code>&gt;&gt;&gt; self.br.driver.page_source
'&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;head&gt;&lt;link title="Wrap Long Lines" href="resource://gre-resources/plaintext.css" type="text/css" rel="alternate stylesheet" /&gt;&lt;/head&gt;&lt;body&gt;&lt;pre&gt;{"ygPerms":{"resourceCapabilityList":[{"resourceType":"GROUP","capabilities":[{"name":"READ"},{"name":"JOIN"}]},{"resourceType":"PHOTO","capabilities":[]},{"resourceType":"FILE","capabilities":[]},{"resource ...
</code></pre>

<p>Note that the JSON is wrapped in some HTML and pre elements. </p>

<p>How can I get just the JSON, directly? It seems hacky to get the contents of the <code>&lt;pre&gt;</code> in the <code>&lt;body&gt;</code> since I don't know how the browser may choose to represent this JSON response in the future.</p>