Remove unused tests.
Check if we have been provided a valid element before trying to generate a selector.