Refactor the driver to optimize xpath search

The goal here is to avoid doing the same XPath searches many times when performing an action by reusing the same WebElement instance whenever possible.