tests for page object before calling javascript on page