Element counting enhancement

Fixes https://github.com/Codeception/Codeception/issues/662