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
Not sure when this changed, but right now this works for me in Python. The file is a simple page with a javascript error.
In [11]: driver.get("file:///tmp/a.html")
In [12]: driver.get_log("browser")
Out[12]:
[{u'level': u'SEVERE',
u'message': u'ReferenceError: foo is not defined',
u'timestamp': 1450769357488,
u'type': u''},
{u'level': u'INFO',
u'message': u'The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.',
u'timestamp': 1450769357498,
u'type': u''}]
Python-Selenium version 2.48.0 Linux Firefox 43.0