protected void type(By locator, String text)
    {
        if (text != null)
        {
            driver.findElement(locator).clear();
            driver.findElement(locator).sendKeys(text);
        }
    }