js if exists in page code example
Example 1: js check if dom element exists
var myElement = document.getElementById("myElementID");
if(!myElement){
//#myElementID element DOES NOT exist
}
if(myElement){
//#myElementID element DOES exists
}
Example 2: if text exists in element using javascript
if (
(
document.documentElement.textContent || document.documentElement.innerText
).indexOf('Done successfuly') > -1
) {
// Do something...
}