Webdriver Script012 : getAttribute() Method

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

 Title  : Webdriver Script012 : getAttribute() Method
 Author : Gaurav Khanna

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

package com.gaurav.webdriver;

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.firefox.FirefoxDriver;

public class s012_getAttributeMethod {

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

    // Declaring baseURL variable of String Type
    String baseUrl;

    // Declaring attributeValue variable of String Type
    String attributeValue;

    @BeforeMethod
    public void startUp() {

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

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

    @Test
    public void testscript012() {

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

        // Locate Button and Store the value of button to 'attributeValue'
        // variable
        attributeValue = webDriver.findElement(By.id("verifybutton"))
                .getAttribute("value");

        // Printing value of 'attributeValue'
        System.out.println("Attribute Value : " + attributeValue);
    }

    @AfterMethod
    public void shutDown() {

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