Implemented the waitForElement