Add method to wait for element to be available

Add waitForElement() function to poll until element becomes available