I am Automating add to card process of **"<http://www.fnp.com/the-sweet-surprises-genpr-143431-e.html>"** website. I am writing a code Using **TestNG POM** Structure . I got Stuck in task where I am getting **NullPointer Exception** in Handling Autosuggestion. Below is my POM Class

```
public class productPage_POM {
    public WebDriver driver;

    @FindBy(id="tagsf2")
    private WebElement city_txtbox;

public productPage_POM(WebDriver driver)
    {
        PageFactory.initElements(driver, this);
    }

    public void sel_adr()
    {
        city_txtbox.sendKeys("gan");     // on this line i am gettign nullpointer Exception 

        String xp = "//a[starts-with(text(),'gan')]";
        List<WebElement> allList = driver.findElements(By.xpath(xp));
        int count = allList.size();
        System.out.println(count);
        for (int i = 0; i < count ; i++) 
        {
            String name = allList.get(i).getText();
            System.out.println(name);
            if(name.contains("Gandhinagar"))
            {
                allList.get(i).click();
                break;
            }
        }

```

Below is HTML structure

```
<div class="pro_detail">
<div id="changeImage" class="pro_detail_image">
<div class="pro_detail_title">
<div class="pro_detail_size">
<div class="pro_detail_form">
<input id="cityIdHidden" type="hidden" value="CITY-1219">
<input id="hasShippingOption" type="hidden" value="">
<input id="cityIdHidden1" type="hidden" value="">
<input id="liCount" type="hidden" value="1">
<div id="hiddenField">
<div class="pro_detail_form_inn">
<label>1. Where do you want to deliver this?</label>
<input id="tagsf2" class="inp_pro_detail2 election ui-autocomplete-input" type="text" value="Enter City" onchange="showAddtocart();" onblur="WatermarkOnblur('Enter City','tagsf2');shippingOption();" onfocus="WatermarkOnfocus('Enter City','tagsf2')" autocomplete="off">
<span class="ui-helper-hidden-accessible" role="status" aria-live="polite">CITY-1219</span>
<div class="clear"></div>
<div id="cityNotAvailable" class="error_message hide" style="display: none;">
</div>
<div class="textbox">
</div>
<div class="pro_detail_form">
<div id="divDeliveryText" class="pro_detail_form" style="display:none;">
<div id="valentineCatalougueText" class="pro_detail_form" style="display:block;">
<div class="pro_detail_form">

```