Using dynamic locators in methods