appium运行TouchAction类中的页面滑动,报错“ urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))”

pycharm中使用pytest框架运行appium自动化脚本,进行页面滑动的代码运行会报错;
E urllib3.exceptions.ProtocolError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’))

代码如下:
import pytest
import time
from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction

class TestDW():
def setup(self):
caps = {}
caps[“platformName”] = “android”
caps[“appPackage”] = “com.xueqiu.android”
caps[“appActivity”] = “com.xueqiu.android.view.WelcomeActivityAlias”
caps[“deviceName”] = “M92QACQM9877H” # app 加载页面
caps[“skipDeviceInitialization”] = “true”
caps[“unicodeKeyboard”] = “true”
caps[“resetKeyboard”] = “true”
caps[“noReset”] = “true”

    self.driver = webdriver.Remote('http://localhost:4723/wd/hub', caps)  # appium服务器的连接地址
    self.driver.implicitly_wait(10)

def teardown(self):
    self.driver.quit()


def test_touchaction(self):
    action=TouchAction(self.driver)
    window_rect=self.driver.get_window_rect()
    width=window_rect['width']
    height=window_rect['height']
    x1=int(width/2)
    y_start=int(height*4/5)
    y_end=int(height*1/5)
    time.sleep(5)
    action.press(x=x1,y=y_start).wait(200).move_to(x=x1,y=y_end).release().perform()

if name == ‘main’:
pytest.main()

建议贴一下appium的日志哈 方便分析问题,存到txt里用附件形式发上来就行了

好的,下次注意,今天跑又可以了。。。感觉是网络问题

关闭