Delete HTML element from Flutter webview

I’m unable to remove an element dynamically from a web page. After running the code, the element still shows up on screen and is only removed when clicked.

onPageFinished: (url){
        removeAds(url);
      },
 void removeAds(String url){
      print("asdjkhjahsdk");
      _controller.evaluateJavascript('var ad= document.getElementById("_b04pct_2709847"); ad.parentNode.removeChild(ad);');
  }

The code is using JavaScript to remove an element with the ID “_b04pct_2709847” from the web page. The code should work correctly. However, it’s possible that there is a delay in the execution of the code or the element is being added back by some other script.