Webdriverjs apparently has an inbuilt method which allows you to wait for an element.
var saveButton = driver.wait(until.elementLocated(By.xpath("//div[text() = 'Save']")), 5000);
driver.wait(until.elementIsVisible(saveButton), 5000).click();
Using this method results in an error "ReferenceError: until is not defined". Why is this method not working?