Issue #3476Opened May 24, 2021by krishnaeverestengineering0 reactions

BUG: TypeError: Cannot read property 'querySelector' of null

Question

<img width="1172" alt="Screenshot 2021-05-24 at 6 55 23 PM" src="https://user-images.githubusercontent.com/55732888/119354444-b8cbb500-bcc1-11eb-8e67-27e020c879aa.png">

I was getting this error while writing unit tests and I am testing editor instance to be defined. Randomly test case is passing but mostly I am getting this error.

Answers (2)

YyueeiWYMay 24, 20210 reactions
Code SnippetHTML
It seems like u are missing the class name or parent element ID.

below is the example of using querySelector.

<pre>
var parentElement = document.getElementById('deviceready');
var listeningElement = parentElement.querySelector('.listening');
console.log(listeningElement);

&lt;div id="deviceready"&gt;
   &lt;div class="listening"&gt;
   &lt;/div&gt;
&lt;/div&gt;

</pre>
artfMay 25, 20210 reactions

Sorry but this might depend on way too many factors (eg. your environment) and has nothing to do with the core itself.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.