Reusable Script In Selenium

import java.io.FileInputStream;


import jxl.Sheet;
import jxl.Workbook;

import com.thoughtworks.selenium.DefaultSelenium;
public class ReusableScript {
public static DefaultSelenium selenium = new DefaultSelenium("localhost",
6666, "*iehta", "http://");
public static String gmail() throws Exception {
selenium.start();
selenium.open("http://www.gmail.com");
selenium.windowMaximize();
Thread.sleep(2000);
selenium.click("link=Create an account »");
selenium.waitForPageToLoad("30000");
return "pass";
}
public static String Register() throws Exception {
FileInputStream fi = new FileInputStream(
"D:\\Framework\\TestData\\Register.xls");
Workbook w = Workbook.getWorkbook(fi);
Sheet s = w.getSheet(0);
for (int i = 1; i < s.getRows(); i++) {
if (!s.getCell(3, i).getContents().equals("")) {
if (s.getCell(2, i).getContents().contains("Text")) {
if (selenium
.isElementPresent(s.getCell(0, i).getContents())) {
selenium.type(s.getCell(0, i).getContents(), s.getCell(
3, i).getContents());
}
} else if (s.getCell(2, i).getContents().contains("Combo")) {
if (selenium
.isElementPresent(s.getCell(0, i).getContents())) {
selenium.select(s.getCell(0, i).getContents(), "label="
+ s.getCell(3, i).getContents());
}
} else if (s.getCell(2, i).getContents().contains("chkbox")) {
if (selenium
.isElementPresent(s.getCell(0, i).getContents())) {
selenium.click(s.getCell(0, i).getContents());
}

} else if (s.getCell(2, i).getContents().contains("Radio")) {
if (selenium
.isElementPresent(s.getCell(0, i).getContents())) {
selenium.click(s.getCell(0, i).getContents());
}

}
else if (s.getCell(2, i).getContents().contains("Button")) {
if (selenium
.isElementPresent(s.getCell(0, i).getContents())) {
selenium.click(s.getCell(0, i).getContents());
}
}
}

}

return "pass";
}

public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
gmail();
Register();

}

}