title: How to delete DOM element from Selenium Java
body: <p>I am trying to delete an element from a website using Selenium and Java, I have the xpath of the element</p>
  <pre><code>WebElement m = driver.findElement (By.xpath (&quot;//*[contains(text(),'discord.gg/')]&quot;));
  </code></pre>
  <p>Thats the element I have. I want to delete it. I tried</p>
  <pre class="lang-js prettyprint-override"><code>$(&quot;//*[contains(text(),'discord.gg/')]&quot;).remove();
  </code></pre>
  <p>But that doesnt work either.</p>
  <p>Thanks</p>