我正在使用Selenium webdriver
但它不会退出chrome
并且chrome
正确驱动。一些过程沉闷的赛跑者。
退出 chrome 的代码:
driver.quit();
Run Code Online (Sandbox Code Playgroud)
启动 chrome 的代码:
System.setProperty("webdriver.chrome.driver","/<path to chrome driver>/chromedriver");
ChromeOptions options = new ChromeOptions();
options.setBinary(new File("/<path to chrome >/google-chrome"));
driver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)
Chrome 驱动程序版本:2.9.248304 Chromium 版本:40.0.2214.115 Selenium 版本:2.32 操作系统:Linux java.version:1.7.0_71
提前致谢,奈拉
有 webclient 的以下实现:
public <T> WebClient.ResponseSpec sendRequest(HttpMethod method, String contentType, T body, String baseUrl, String path) {
try {
WebClient webClient = WebClient.builder().baseUrl(baseUrl).filter(logRequest()).build();
WebClient.ResponseSpec responseSpec = webClient.method(method)
.uri(path)
.header(HttpHeaders.CONTENT_TYPE, contentType)
.body(BodyInserters.fromObject(body))
.retrieve();
return responseSpec;
} catch (Exception e) {
throw new WebClientProcessingException("Exception when trying to execute request", e);
}
}
// This method returns filter function which will log request data
private static ExchangeFilterFunction logRequest() {
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
LOGGER.info("Request: {} {} {}", clientRequest.method(), clientRequest.url(), clientRequest.body());
clientRequest.headers().forEach((name, values) -> …
Run Code Online (Sandbox Code Playgroud)