??????????????set??get??????????з????????????????????????????????????н??д???
?????????????????

 

import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
/*
*?????????set??get??????????????????????set??????get????
*/
public class LoginCenter {
//?????????????????
private FirefoxProfile profile = new FirefoxProfile(new File("C:\Users\qinfei\AppData\Roaming\Mozilla\Firefox\Profiles\sdk"));
private WebDriver driver=new FirefoxDriver(profile);
private String baseUrl;
//?????????????????????????????????ó?????
public void setWebDriver(WebDriver dri){
if(dri!=null){
driver=dri;
}
}
// ??????????????
public WebDriver getWebDriver(){
return driver;
}
//???????url????????????????
public void setbaseUrl(String url){
if(url!=null){
baseUrl=url;
}
}
//???????????
public String getbaseUrl(){
return baseUrl;
}
}

??????????????????LoginCenter???е????

 

import org.openqa.selenium.WebDriver;
public class Test101 {
public static void main(String[] args){
WebDriver dri=null;
String url;
//???÷??????????????????
LoginCenter lo=new LoginCenter();
//????LoginCenter???е?setbaseUrl????????????
lo.setbaseUrl("http://www.baidu.com");
//????????????
url=lo.getbaseUrl();
//??????е???LoginCenter???е?setWebDriver???????????????????????
dri=lo.getWebDriver();
//?????Test101??
Test101 t1=new Test101();
//????Test101???е?test???????????????????????????????
t1.test(dri?? url);
}
public void test(WebDriver dri??String url){
//???get??????????????????
dri.get(url);
}
}

 ??????java application????????У??????

?????????е?Ч?????