当前位置:   article > 正文

appium报错:An unknown server-side error occurred while processing the command._appium执行连接小米9an unknown server-side error occurred

appium执行连接小米9an unknown server-side error occurred while processing th

appium运行过程中报错:

An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: read ECONNRESET

出错代码如下,查了好多方法都无法解决,只好直接去看源码

  1. #coding:utf-8
  2. from appium import webdriver
  3. import time
  4. desired_caps = {
  5. 'platformName':'Android',
  6. 'platformVersion':'7.1',
  7. 'deviceName':'c353ce90',
  8. 'fastReset': 'false',
  9. 'fullReset': 'false',
  10. 'noReset':'true',
  11. 'nativeWebScreenshot': 'true',
  12. 'androidScreenshotPath':'target/screenshots',
  13. 'automationName':'uiautomator2',
  14. 'appPackage':'com.tencent.mm',
  15. 'appActivity':'com.tencent.mm.ui.LauncherUI',
  16. 'chromeOptions':{'androidProcess':'com.tencent.mm:appbrand1'}
  17. }
  18. driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_caps)
  19. print(driver.current_activity)
  20. time.sleep(5)
  21. print("点击发现")
  22. driver.find_element_by_xpath("//*[@text='发现']").click()
  23. # 获取屏幕的size
  24. size = driver.get_window_size()
  25. # 获取屏幕宽度 width
  26. width = size['width']
  27. print(width)
  28. # 获取屏幕高度 height
  29. height = size['height']
  30. # 执行滑屏操作,向上(上拉)滑动
  31. x1 = width*0.5
  32. y1 = height*0.9
  33. y2 = height*0.25
  34. time.sleep(3)
  35. print("滑动前")
  36. driver.swipe(x1,y1,x1,y2)
  37. print("滑动后")
  38. time.sleep(3)
  39. print("点击小程序")
  40. driver.find_element_by_xpath("//*[@text='小程序']").click()
  41. time.sleep(10)
  42. print(driver.page_source)
  43. driver.find_element_by_xpath("//*[@text='猜歌王']").click()

 

源码显示如下:

因此,将出错代码的

'automationName':'uiautomator2',

 改为如下即可

'ANDROID_UIAUTOMATOR':'uiautomator2',

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/974191
推荐阅读
相关标签
  

闽ICP备14008679号