How to change an alert function by fill function on a chrome extension?

in my chrome extension I have the codes below which display alerts correctly:

manifeste.json

{
    "name": "Zero",
    "version": "1.0",
    "manifest_version": 3,
    "description": "Auto fill form GRC",
    "icons": { 
        "16": "icon/icon.png",
        "48": "icon/icon.png",
        "128": "icon/icon.png" 
    },
    "action": {
        "default_popup": "index.html",
        "default_icon": "icon/icon.png"
    },
    "options_page": "options.html",
    "content_scripts": [
        {
            "matches" : [
                "http://*/*",
                "https://*/*"
            ],
            "js": ["jquery-3.6.0.min.js", "popup.js"]
        }
    ],
    "permissions": [
        "activeTab",
        "storage",
        "scripting",
        "tabs",
        "clipboardWrite",
        "notifications",
        "contextMenus"
    ]
}

index.html

<!doctype html>
<html>
  <head>
<style>
body {
min-width: 120px;
overflow-x: hidden;
font-family: Arial, sans-serif;
font-size: 12px;
        }
        input, textarea {
            width: 140px;
        }
        input#save {
            font-weight: bold; width: auto;
 
        }
    </style>
 
  </head>
  <body>
<h1>GRC</h1>
    <center><form>
  <div>
<label><b>Veuillez saisir un code</b></label>
    <input name="inpt" id="inpt" autocomplete="off"/>
 <p>
<button id="btn">Enter</button>
<script src="popup.js"></script>
</p>
  </div>
</form></center>
  </body>
</html>

popup.js

const button = document.getElementById('btn');
const input = document.getElementById('inpt');

button.onclick = () => {
  functions[input.value]();
};

functions = {
  1: function () { alert(1); },
  2: function () { alert(2); },
  3: function () { alert(3); },
  4: function () { alert(4); },
  5: function () { alert(5); },
  6: function () { alert(6); },
}

I want to keep the same principle, but I want to replace the alert functions with web form filling functions as follows:

instead of

1: function () { alert(1); },

i want to put

1: function () { 
var element = document.getElementById('select1');
var element = document.getElementById('select2');
if (element != null && element.value == '') {
const select1 = document.getElementById('select1');
const select2 = document.getElementById('select2');

select1.addEventListener('change', () => {
select2.removeAttribute('disabled');
});

setTimeout(() => {
select1.value = '2: Object';
select1.dispatchEvent(new Event("change"));
}, 1E3);

setTimeout(() => {
select2.value = '1: Object';
select2.dispatchEvent(new Event("change"));
}, 2E3);
}
},

When I did the test with the method I just mentioned, I received the following error message:

image

Is there a solution that allows me to do this. I’m fairly new to all of this, so any help would be much appreciated.