Added when_present method for links to wait
Added encoding for tests