Is there a way to capture errors occurring in the DOM in Selenium and probably flag the same as an error in the page?
To give a brief exam
I would like to iterate on the answer of jhanifen. Here is a javascript solution that does not depend on jQuery. It creates an invisible HTML list on the bottom of the page, which contians the errors.
(function () {
var ul = null;
function createErrorList() {
ul = document.createElement('ul');
ul.setAttribute('id', 'js_error_list');
ul.style.display = 'none';
document.body.appendChild(ul);
}
window.onerror = function(msg){
if (ul === null)
createErrorList();
var li = document.createElement("li");
li.appendChild(document.createTextNode(msg));
ul.appendChild(li);
};
})();