Fix waitForElement and test for waitFor