Don't crash on DOMText nodes

The list returned by DOMNavigator::findElementsWithClass can contain DOMText
nodes. To avoid crashing, check the nodeType.

Change-Id: Iaed24988134fbd0dda11719645fd94c7a05cbc50