Reputation: 29
I want to remove a h1 tag value from body content (html page) for that
Im using String h1 = driver.findElement(By.xpath("//div[@class='tab_content active']/h1")).getText(); String content = cont.replace(h1,"");
but by this way it is removing all the matching text from the content and the particular h1 tag
can anyone suggest how to do this
Upvotes: 0
Views: 43
Reputation: 2707
String h1 = driver.findElement(By.xpath("//div[@class='tab_content active']/h1")).getText();
String content = cont.replace("<h1>"+h1+"</h1>","<h1></h1>");
It will remove the particular h1 tag text
Upvotes: 1