????????web????????????????????????????Selenium WebDriver?????????????Selenium WebDriver??????????????????????????????????????Chrome??Firefox??IE??????????????????Android??IPhone????????????????PhantomJS??????PhantomJS?????????????????????????????????
???????????????Selenium WebDriver???????????????Щ?????е??????Selenium WebDriver???????????汾??????????????е???Selenium WebDriver?????bug???????????????Selenium WebDriver?Щ?????????????????????????£??????????????????????????????????Щ?????????·?????????????Щ???WebDriver????????????????????????
????WebDriver?????????Firefox???????????????????????profile?????????????Firefox??profile?????????????????????????????web??????????????????????????Firefox????????в????????WebDriver?????Firefox?????????????????profile????????????????FirefoxProfile?????á?

 

public WebDriver create() {
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("network.proxy.type"??1);
firefoxProfile.setPreference("network.proxy.http"??yourProxy);
firefoxProfile.setPreference("network.proxy.http_port"??yourPort);
firefoxProfile.setPreference("network.proxy.no_proxies_on"??"");
return new FirefoxDriver(firefoxProfile);
}

???????FirefoProfile?????????Firefox???????????á?????????Firefox????????????????????????Firefox??????μ?????plugin??????У??????????????????μ?profile?????????plugin??
???????WebDriver?????????Button????????????Button????????????????????????????????????У?????Button????????????????????????????????????????WebElement.Click()???????????Click?????
???????????????????????????????????Click??JavaScript??
????((JavascriptExecutor)webDriver).executeScript("arguments[0].click();"?? webElement);
?????????????Щ??????????????????ü????Wait???????page load???????к???????????????????????????ж?document.readyState?????complete??

 

protected Function<WebDriver?? Boolean> isPageLoaded() {
return new Function<WebDriver?? Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
return ((JavascriptExecutor) driver).executeScript("return document.readyState").equals("complete");
}
};
}
public void waitForPageLoad() {
WebDriverWait wait = new WebDriverWait(webDriver?? 30);
wait.until(isPageLoaded());
}