How to check length of body element in iFrame

I have an iFrame that I would like to check the length of the body element within in it. My iFrame looks like this:

<iframe id='1' width='1' height='1' style={{visibility = 'hidden'}}></iframe>

When I console log out document.getElementById(‘1’), I get back this in the console:

<iframe id='1' width='1' height='1' style=visibility = 'hidden'>
#document
 <html>
    <head></head>
    <body></body>
 </html>
</iframe>

I would like to be able to check the length of the body element in this iframe and base some logic around this.

My main issue from looking for solutions on SO is that when I try to check the contentDocument of my iframe (such as document.getElementById('1').contentDocument or document.getElementById('1').contentWindow) I get back an error saying cannot read contentDocument or contentWindow of null. I would just like to see if the body element has anything in it. How would I go about this?