Printing Drop Down Values

/*********************************************************************

 Script Summary

 Title  : Webdriver Script016 : Printing Drop Down Values
 Author : Gaurav Khanna

 1. Set the Base URL to "http://book.theautomatedtester.co.uk/chapter1".
 2. Find the Drop Down menu.
 3. Print the values of options present.
 4. Click on option 'Selenium Grid'.
 5. Prints the selected option in drop down.

 *********************************************************************/

package com.gaurav.webdriver;

import java.util.List;

import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class s016_PrintingDropDownValues {

    // Declaring variable 'webDriver' of WebDriver Type
    WebDriver webDriver;

    // Declaring baseURL variable of String Type
    String baseUrl;

    @BeforeMethod
    public void startUp() throws Exception {

        // Initializing FireFox Driver
        webDriver = new FirefoxDriver();

        // Assigning URL to variable 'baseUrl'
        baseUrl = "http://book.theautomatedtester.co.uk/chapter1";
    }

    @Test
    public void testscript016() throws Exception {

        // Open the link
        webDriver.get(baseUrl);

        // Maximize browser window
        webDriver.manage().window().maximize();

        // Creates a List of type WebElement which will store all values present
        // in dropdown
        List<WebElement> dropDownValues = webDriver.findElements(By
                .xpath("//*[@id='selecttype']"));

        // This loop will assign all values present in 'dropDownValues' to
        // 'dropDownElements'
        for (WebElement dropDownElements : dropDownValues) {

            // This will print the List "dropDownElements"
            System.out.println(dropDownElements.getText());
        }

    }

    @AfterMethod
    public void shutDown() throws Exception {

        // This will close the browser
        webDriver.quit();
    }

}