Make sure that hasClassName method exists

Soem elements haven't hasClassName mathod, resutling into TypeError. See [1] for details.
[1] https://github.com/jenkinsci/form-element-path-plugin/pull/2