??????????? Selenium ???????
????Selenium API ????????????????????????????? Java ?????


????
? 1. Selenium ???????

  ???嵥 1. ??? Selenium API ???? - ??? SmartCloud iNotes
package demo;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class SeleniumDemo {
public static void main(String[] args) throws InterruptedException {
// ??????? Selenium ???
Selenium selenium = new DefaultSelenium("localhost"?? 4444??
"*firefox"?? "https://apps.na.collabserv.com/");
// ??? selenium session
selenium.start();
// ?????????
selenium.open("https://apps.lotuslive.com/");
// ???????????????
selenium.type("//input[@id='username']"??
"autouser01@e3yunmail.mail.lotuslive.com");
selenium.type("//input[@id='password']"?? "test");
// ???
selenium.click("//input[@id='submit_form']");
// ???????????? Mail ????
int count = 60;
while(count > 0){
if(selenium.isElementPresent("//a[contains(text()??'Mail')]")){
break;
}else{
Thread.sleep(1000);
count--;
}
}
// ???
selenium.click("//a[contains(text()??'Log Out')]");
// ???????????? selenium session
selenium.stop();
}
}