解决Original error: Could not proxy command to remote server. Original error: Error: socket hang up

使用appium自动化测试时,报错:Original error: Could not proxy command to remote server. Original error: Error: socket hang up

 

去掉uiautomator2后,可执行成功

desired_caps['automationName'] = 'uiautomator2'

 

经分析后,是因为uiautomator2版本不对

解决办法:

在终端执行以下命令:

adb  uninstall io.appium.uiautomator2.server
adb  uninstall io.appium.uiautomator2.server.test

然后重新安装Appium Settings即可解决以上问题

 

已标记关键词 清除标记
相关推荐
    App启动参数如下(存放在Yaml文件中): ``` automationName: UiAutomator2 platformName: Android platformVersion: 7 deviceName: Android Emulator appPackage: com.ellabook appActivity: com.ellabook.startup.StartActivity noReset: False unicodeKeyboard: True # 将键盘给隐藏起来 resetKeyboard: True ```      其他信息:       Appium 1.15       模拟器: 雷电模拟器4.0.7       测试框架: pytest conftest.py内容如下: ``` def basedriver(port=4723, **kwargs): """ 根据设置的参数,启动会话,并返回会话对象 :param port: 会话启动端口号---int :param kwargs: 启动参数 :return: 会话对象 """ yamls = YAML(typ='safe') yaml_path = os.path.join(CAPS_PATH, "desire_caps.yaml") fs = open(yaml_path, encoding='UTF-8') desire_caps = yamls.load(fs) if kwargs: for key, value in kwargs.items(): desire_caps[key] = value driver = webdriver.Remote("http://localhost:{}/wd/hub".format(port), desire_caps) return driver @pytest.fixture(scope="class") def initdriver_first_start(): """App首次启动""" driver = basedriver(noReset=False) yield driver driver.close() ```     测试用例py文件内容: ``` @pytest.mark.usefixtures("initdriver_first_start") class TestAPPStart: """APP启动页测试: 是否进入启动页 、banner图正常滑动、点击"开始看书吧"进入登录界面 """ def test_0_into_start(self, initdriver_first_start): """APP首次启动,启动页是否展示“开始阅读吧”按钮 """ driver = initdriver_first_start AppStartPage(driver).check_read_book_is_exist() def test_banner_left_slip(self, initdriver_first_start): """APP首次启动,启动页广告图能够向左滑""" driver = initdriver_first_start AppStartPage(driver).slide_start_banner("left") # App首次启动,banner广告图正常切换 def test_banner_right_slip(self, initdriver_first_start): """APP首次启动,启动页广告图能够能够向右滑""" driver = initdriver_first_start AppStartPage(driver).slide_start_banner("right") # App首次启动,banner广告图正常切换 def test_click_button(self, initdriver_first_start): """APP首次启动,点击开始按钮,查看是否进入登录界面""" driver = initdriver_first_start AppStartPage(driver).click_start_read() # 点击“开始阅读” 按钮 LoginPage(driver).check_into_login_idle() # 查看是否进入登录界面 ```     APP启动页测试 测试类(pytest/py.test方式)运行,此时用例执行完成后,在进行测试类的teardown时,却报错: selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 404 - undefined ![图片说明](https://img-ask.csdn.net/upload/201912/26/1577335992_418416.png)  网上百度了一堆资料,但依旧没有相关: 404 - undefined 的报错类型的解决方法(忧伤)
server: const http = require("http"); const qs = require("querystring") http.createServer(function(request,response){ var body =""; request.on("data",function(chunk){ body+=chunk; }) request.on("end",function(){ response.writeHead(200,{"ContentType":"text/html;charset=utf-8"}); process.stdout.write("got name :"+ qs.parse(body)["name"]+"\n") }) }).listen(3000); client: var http = require("http"); var qs = require("querystring") function getname(theName){ var b = {name:theName}; console.log(b) var a=qs.stringify(b) console.log(typeof theName) console.log("theName:"+theName+" ,b转换为string后的a:"+a); var options = { hostname: '127.0.0.1', port: 3000, path: '/', method: 'POST', headers: { 'Content-Type':'application/x-www-form-urlencoded', 'Content-Length': a.length } }; http.request(options,function(response){ response.setEncoding('utf8'); var body =""; response.on('data', function(chunk){ body+=chunk; }); response.on('end',function (){ process.stdout.write("client compate!\n"); }) }).end(a); } process.stdin.on("data",function(inputData){ process.stdout.write("your name:"+inputData); console.log("输入内容: "+inputData+" 转换为string后:"+inputData.toString().replace("\n","")) getname(inputData.toString().replace("\n","")); }) 问题是:程序执行过4分钟左右报错,报错内容如下: events.js:141 throw er; // Unhandled 'error' event ^ Error: socket hang up at createHangUpError (_http_client.js:213:15) at Socket.socketOnEnd (_http_client.js:305:23) at emitNone (events.js:72:20) at Socket.emit (events.js:166:7) at endReadableNT (_stream_readable.js:923:12) at nextTickCallbackWith2Args (node.js:458:9) at process._tickCallback (node.js:372:17) Process finished with exit code 1
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页