解决Chromedriver报错Could not proxy command to remote server

报错信息如下:

复制代码
error: Chromedriver: Error: Could not proxy command to remote server. Original e
rror: Error: connect ECONNREFUSED 127.0.0.1:9515
    at JWProxy.proxy$ (lib/proxy.js:109:13)
    at tryCatch (D:\Appium\node_modules\appium\node_modules\appium-chromedriver\
node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.
js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (D:\Appium\node_modules\ap
pium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modu
les\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (D:\
Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-
jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (D:\Appium\node_modules\appium\node_mod
ules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-run
time\regenerator\runtime.js:136:37)
    at bound (domain.js:250:14)
    at GeneratorFunctionPrototype.runBound (domain.js:263:12)
    at run (D:\Appium\node_modules\appium\node_modules\appium-chromedriver\node_
modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\libr
ary\modules\es6.promise.js:89:39)
    at D:\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modul
es\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\m
odules\es6.promise.js:100:28
    at flush (D:\Appium\node_modules\appium\node_modules\appium-chromedriver\nod
e_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\li
brary\modules\$.microtask.js:17:13)
    at doNTCallback0 (node.js:407:9)
    at process._tickDomainCallback (node.js:377:13)
 [Error: Could not proxy command to remote server. Original error: Error: connec
t ECONNREFUSED 127.0.0.1:9515]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down"
,"status":0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRun
ner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.andro
id.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 178.718
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] We shut down because no new commands came in
复制代码

 

解决办法: appium的配置里设置recreateChromeDriverSessions为true,具体如下:

capabilities.setCapability("recreateChromeDriverSessions", true);

posted @   ycyzharry  阅读(4880)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构

喜欢请打赏

扫描二维码打赏

支付宝打赏

点击右上角即可分享
微信分享提示