Refactor delete method in webdriver tests