Introduced waitForSelector functional test helper

Eases writing wait operations for DOM elements.