Question: I have one java object which is using enum type

```
  public class Deal{

public enum PriceType {
        fixed, hour, month, year
    }

     @Element(name = "price-type", required = false)
     private PriceType priceType;

  }

```

this object is get populated from some API and I am retriving this in database object having string type variable

```
MyDeal{
    private String priceType;

    public String getPriceType() {
    return priceType;
   }

    public void setPriceType(String priceType) {
    this.priceType = priceType == null ? null : priceType.trim();
   }

}

```

why can't I set my database object like 

```
 List<Deal>deals = dealResource.getAll(); 
 MyDeal myDeal = new myDeal(); 

 for (Deal deal : deals) {
     myDeal.setPriceType(deal.getPriceType());
 }

```

Answer: 
You can use **WebdriverWait** for all the - ( 1.wait for page load 2.Find the element 3.If not found refresh )

```
   WebDriverWait wait = new WebDriverWait(driver, 18); // Times Out after 18 Seconds
    PageUtil.refreshObject(driver, By.linkText("Element")); // refresh the Element
    wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Element"))); // wait till  Element is Enabled and Visible before Clicking on that Element

    /**
    *Pass the Control to that Element and Click on that Element (preferred in IE)
    *
    */
    WebElement element = driver.findElement(By.linkText("Element"));
    element.sendKeys(org.openqa.selenium.Keys.CONTROL);
    element.click();

```

and Here is the **RefreshObject** method and **PageUtil** is the ClassName

```
public static WebElement refreshObject(WebDriver driver, By locator) {
        int counter = 0;

        try {
            counter = counter + 1;

            return driver.findElement(locator);
        }

        catch (StaleElementReferenceException e) {

            return refreshObject(driver, locator);

        }

    }

```
do you have a special business case that requires this? If you don't you could just setup a implicit wait when you setup the driver object. In c# it would look something like:

```
myDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));

```

Many would say you should avoid implicit waits, but if you feel you need to go so far as to build a convenience method maybe the implicit wait is preferable.