Implement withRootElement and withRootLocator