I'm trying to make chapters for the video player, however, I faced some difficulties. When you run the code below, test li appears with the video or without but if you uncomment these two lines, li disappears. It looks like the page doesn't load before the script but the solution I had found didn't help me. What is the problem?
<!DOCTYPE html>
<html lang="ru">
<head>
<title>
Video Player
</title>
</head>
<body>
<video id="video" width="800" height="600" autoplay controls>
<source src="Video.mp4" type="video/mp4">
<track id="track" src="Video.vtt" kind="chapters" srclang="en">
</video>
<ol id="Chapters">
<!---There chapters will be--->
</ol>
<script type="text/javascript">
// let Video = document.getElementById("video");
// let Tracks = Video.getElementById("track");
let Chapt = document.getElementById("Chapters");
let Text = document.createTextNode("test");
let li = document.createElement("li");
Chapt.append(li);
li.appendChild(Text);
</script>
</body>
</html>