'TypeError: Cannot read property 'addEventListener' of null' error appeared in migration to Unity 2020

I am attempting to migrate my project to the 2020.1.0f1 version of Unity. The following code, stored as a plugin in the Plugins folder, used to work in 2019 but now throws the error ‘Cannot read property ‘addEventListener’ of null’.

  var LoadFileOnClick= {
      LoadCaptureClick: function() {
        if (!document.getElementById('Input')) {
          var fileInput = document.createElement('InputFile');
          fileInput.setAttribute('type', 'file');
          fileInput.setAttribute('id', 'InputFile');
          fileInput.setAttribute('accept', '.inputfiletype');
          fileInput.style.visibility = 'hidden';
          fileInput.onclick = function (event) {
            this.value = null;
          };
          fileInput.onchange = function (event) {
            SendMessage('Canvas', 'InputFile', URL.createObjectURL(event.target.files[0]));
    	  }
          document.body.appendChild(fileInput);
        }
        var OpenFileDialog = function() {
          document.getElementById('InputFile').click();
          document.getElementById('#canvas').removeEventListener('click', OpenFileDialog);
        };
        document.getElementById('#canvas').addEventListener('click', OpenFileDialog, false);
      }
    };
    mergeInto(LibraryManager.library, LoadFileOnClick);

My JS knowledge is extremely limited, but my best guess is that the onclick function is now being called before the addeventlistener is finished. However, I can’t figure out how to either change this timing or what. Calling the dll at awake simply fires the error at awake, rather than adding the element to the frame and awaiting the onclick event.

It appears that the base name of the unity container element has changed to ‘unity-container’ from the old versions ‘#canvas

Whether or not this is a variable name or not is something I’m investigating now.