问题描述
我当前正在使用Selenium 3.14.0库,其中不建议使用 org.openqa.selenium.remote.internal.ApacheHttpClient .应该改用哪个?
I am currently using Selenium 3.14.0 library in which org.openqa.selenium.remote.internal.ApacheHttpClient is deprecated with no other information. Which should be used instead?
该类已在下一版本3.141.59中删除.
The class is already removed in the next version, 3.141.59.
我将它与EdgeDriver服务一起使用,如下所示:
I am using it with EdgeDriver Service like following:
final int connectionTimeout = 2 * 60 * 1000;
final int socketTimeout = 10 * 60 * 1000; // 10 minute timeout
final ApacheHttpClient.Factory clientFactory = new ApacheHttpClient.Factory(
new HttpClientFactory(connectionTimeout, socketTimeout));
...
edgeDriverService = new EdgeDriverService.Builder()
.usingDriverExecutable(edgeDriver)
.usingAnyFreePort()
.build();
edgeDriverService.start();
HttpCommandExecutor executor = new HttpCommandExecutor(
new HashMap<>(), edgeDriverService.getUrl(), clientFactory);
WebDriver driver = new RemoteWebDriver(executor, new EdgeOptions());
推荐答案
HTTP客户端已切换为okhttp: http://square.github.io/okhttp/
The HTTP client was switched to okhttp: http://square.github.io/okhttp/
在3.11.0版的Selenium Java CHANGELOG中提到了这一点,您也可以在源代码中看到它.
This is mentioned in the Selenium Java CHANGELOG of version 3.11.0 and also you can see it in the source code.
这篇关于Selenium 3.14.0中不推荐使用org.openqa.selenium.remote.internal.ApacheHttpClient-应该使用什么代替?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!