appium报错:コマンドの処理中に不明なサーバー側エラーが発生しました。

appiumの実行中にエラーが報告されます。

コマンドの処理中に不明なサーバー側エラーが発生しました。元のエラー:コマンドをリモートサーバーにプロキシできませんでした。元のエラー:エラー:ECONNRESETを読み取ります

エラーコードは次のとおりです。多くのメソッドをチェックして解決できなかったため、ソースコードに直接アクセスする必要がありました。

#coding:utf-8

from appium import webdriver
import time


desired_caps = {
        'platformName':'Android',
        'platformVersion':'7.1',
        'deviceName':'c353ce90',
        'fastReset': 'false',
        'fullReset': 'false',
        'noReset':'true',
        'nativeWebScreenshot': 'true',
        'androidScreenshotPath':'target/screenshots',
        'automationName':'uiautomator2',
        'appPackage':'com.tencent.mm',
        'appActivity':'com.tencent.mm.ui.LauncherUI',
        'chromeOptions':{'androidProcess':'com.tencent.mm:appbrand1'}
}

driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_caps)
print(driver.current_activity)


time.sleep(5)
print("点击发现")
driver.find_element_by_xpath("//*[@text='发现']").click()

# 获取屏幕的size
size = driver.get_window_size()
# 获取屏幕宽度 width
width = size['width']
print(width)
# 获取屏幕高度 height
height = size['height']

# 执行滑屏操作,向上(上拉)滑动
x1 = width*0.5
y1 = height*0.9
y2 = height*0.25
time.sleep(3)
print("滑动前")
driver.swipe(x1,y1,x1,y2)
print("滑动后")
time.sleep(3)


print("点击小程序")
driver.find_element_by_xpath("//*[@text='小程序']").click()
time.sleep(10)
print(driver.page_source)
driver.find_element_by_xpath("//*[@text='猜歌王']").click()

 

ソースコードは次のとおりです。

したがって、エラーコード

'automationName':'uiautomator2',

 次のように変更できます

'ANDROID_UIAUTOMATOR':'uiautomator2',

 

 

おすすめ

転載: blog.csdn.net/dream_18/article/details/85343787