Today I am going to explain how to set value in select drop-down using selenium? If select box has name or id and it has multiple option than we can set value by this way.

  WebElement select=driver.findElement(By.id("countryName"));
        List<WebElement> options = select.findElements(By.tagName("option"));
        for(WebElement option : options){
            if(option.getText().equals("INDIA")) {
                option.click();
                break;
            }
        }

Here first-of-all create a instance of WebDriver as

WebDriver driver = new FirefoxDriver()

I have used FirefoxDriver but you can use any of the driver as per yourrequirement.
For selecting option from select box I have made instance of webElement and found select box using it’s id(“countryName”). By using webElement instance I fetched list of option that select box has by tagName. At last I have used for loop to get all value of list and checked option value equals to “INDIA” and if condition is true than I have clicked on that option.By this way INDIA will be selected in select box.