Added wait for element function to replace hardcoded time to wait