package com.test;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;
public class NewTest {
String url = "
http://www.google.com";
private Selenium selenium= new DefaultSelenium("localhost", 4444, "*firefox", url);
@Test
public void f() {
selenium.start();
selenium.open("
http://bpmdev3.nmg.com.hk/suite/portal/login.htm");
selenium.type("id=username", "sososu");
selenium.type("id=password", "so1357");
selenium.click("id=submitButton");
selenium.waitForPageToLoad("30000");
//login process
selenium.selectFrame("fContent");
selenium.click("id=applicationNameLink");
selenium.click("link=Leave Application 假期申請應用程式");
//wait
while (!(selenium.isTextPresent("Leave Form 假期申請表")==true)) {
Thread.sleep(1000);
}
//start process
selenium.click("css=#noStartForm_form_207 > ul > a");
selenium.waitForPopUp("startFormWin", "30000");
selenium.selectWindow("name=startFormWin");
selenium.click("name=buttonLabel");
selenium.waitForPageToLoad("30000");
//input username
Thread.sleep(1000);selenium.type("id=textControl_fd_component_JSON_TASK_NSnumber2", "20110003");
and there are many code behind ...
--
Soso