???WebDriver??????????????Щ????
???????????? ???????[ 2014/7/8 13:38:31 ] ????????WebDriver ????????????
????????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());
}
|
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11