1

Above this is my index.html from my chrome extension :

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Scrapper</title>
  <style>
    body {
      width: 300px;
      height: 300px;
    }
  </style>
</head>
<body id="wrapper-extension-scrapper">
  <h1>PMUP Test</h1>
  <button id="run">Run</button>

  <script src="main.js"></script>
</body>
</html>

It's basic HTML, but I want to grab my wrapper-extension-scrapper identifier

I'm trying to do something like that in my main.js

window.addEventListener("load", ev => {
  console.log(document.getElementById("wrapper-extension-scrapper"))
});

But when I run my chrome extension, he always return null

If you have some advice thanks a lot guys !

KolaCaine
  • 2,037
  • 5
  • 19
  • 31
  • You can use content script access DOM. Please read getting started docs here:https://developer.chrome.com/extensions/getstarted – Aefits Jun 06 '20 at 11:47
  • You can write an example ? To help other people with the same problem ? @elegant-user – KolaCaine Jun 06 '20 at 11:55

0 Answers0