This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DesiredCapabilities cap = DesiredCapabilities.chrome(); | |
Proxy proxy = new Proxy(); | |
proxy.setHttpProxy(httpProxy).setSslProxy(httpProxy); | |
cap.setCapability(CapabilityType.PROXY, proxy); | |
ChromeDriver driver = new ChromeDriver(cap); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1)首先安装必要的字体和xvfb | |
apt-get install xvfb gtk2-engines-pixbuf xfonts-base xfonts-75dpi xfonts-100dpi xfonts-scalable xfonts-cyrillic x11-apps imagemagick | |
2)安装firefox作为测试xvfb的安装是否生效 | |
sudo apt-get install firefox | |
Xvfb -ac :99 -screen 0 1280x1024x16 | |
export DISPLAY=:99 | |
firefox http://ralf.schaeftlein.com | |
xwd -root -display :99 | convert xwd:- capture.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpClient httpClient = HttpClientBuilder.create().build(); | |
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); | |
RestTemplate restTemplate = new RestTemplate(requestFactory); | |
HttpClient is from apache http. | |
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/remoting.html#rest-client-access |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static WebDriver createWebDriver(String localPath) | |
{ | |
System.setProperty("webdriver.chrome.driver", "D:/devtools/webdriver/2.13/chromedriver.exe"); | |
Map<String, String> prefs = new Hashtable<>(); | |
prefs.put("download.prompt_for_download", "false"); | |
prefs.put("download.default_directory", localPath); | |
ChromeOptions options = new ChromeOptions(); | |
options.setExperimentalOption("prefs", prefs); |