iOS-Tagent icon indicating copy to clipboard operation
iOS-Tagent copied to clipboard

点击APP退出按钮后,立即出现 wda.WDAError: WDAError(status=889, value=Application is not running, possibly crashed)

Open StandOutstar opened this issue 5 years ago • 14 comments

用例中点击点击APP退出按钮,立即出现 wda.WDAError: WDAError(status=889, value=Application is not running, possibly crashed),APP实际已退出,点击APP退出按钮是正常操作。

StandOutstar avatar Jul 11 '19 01:07 StandOutstar

xcode型号和手机型号是?iOS-Tagent更到最新了么?

EraChen233 avatar Jul 11 '19 02:07 EraChen233

iPhone 7 xcode 10.2 已更新

StandOutstar avatar Jul 11 '19 02:07 StandOutstar

好的,我查一下

EraChen233 avatar Jul 11 '19 02:07 EraChen233

也有可能是和Poco配合的问题,请注意下

StandOutstar avatar Jul 11 '19 02:07 StandOutstar

好的,你这边要是急得话,可以改用xcode10.1试一下,这个版本xcode比较稳定。

EraChen233 avatar Jul 11 '19 02:07 EraChen233

好的,thx

StandOutstar avatar Jul 11 '19 02:07 StandOutstar

嗨,如果方便的话,可以试一下这个办法吗? https://github.com/AirtestProject/iOS-Tagent/issues/64#issuecomment-515379829

EraChen233 avatar Jul 26 '19 09:07 EraChen233

$ pipenv graph | grep wda
    - facebook-wda [required: Any, installed: 0.2.1]

已经是v0.2.1了。

StandOutstar avatar Jul 26 '19 09:07 StandOutstar

换了之后可以运行了吗?如果还是有报错,方便把完整的error信息截图出来吗?

EraChen233 avatar Jul 26 '19 09:07 EraChen233

我本来版本就已经是这个了,重装可能有用吗

StandOutstar avatar Jul 26 '19 11:07 StandOutstar

目前切换到 xcode 10.1 是没有这个问题的,但是由于开发们所用的是 10.2 版本,所以还是希望 10.2 版本上可以稳定使用

StandOutstar avatar Jul 26 '19 11:07 StandOutstar

部分调用栈如下:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = (UIObjectProxy of "type=Button&不同意",), kw = {}, __tracebackhide__ = True
params = OrderedDict([('timeout', '5')])
args = ['UIObjectProxy of "type=Button&不同意"']

    @wraps(func)
    def impl(*a, **kw):
        __tracebackhide__ = True
        params = func_parameters(func, *a, **kw)
        args = list(map(lambda x: represent(x), a))
        with StepContext(self.title.format(*args, **params), params):
>           return func(*a, **kw)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/allure_commons/_allure.py:153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = UIObjectProxy of "type=Button&不同意", timeout = 5, kwargs = {}

    @allure.step("等待点击控件, 参数:")
    def wait_click(self, timeout=5, **kwargs):
        try:
            self.wait_for_appearance(timeout=timeout)
>           self.click(**kwargs)

project_commons/pages/base_page.air/base_page.py:442: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

proxy = UIObjectProxy of "type=Button&不同意", args = (), kwargs = {}

    @wraps(func)
    def wrapped(proxy, *args, **kwargs):
        try:
>           return func(proxy, *args, **kwargs)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/poco/proxy.py:23: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = UIObjectProxy of "type=Button&不同意", focus = 'anchor'
sleep_interval = None

    @wait
    def click(self, focus=None, sleep_interval=None):
        """
        Perform the click action on the UI element(s) represented by the UI proxy. If this UI proxy represents a set of
        UI elements, the first one in the set is clicked and the anchor point of the UI element is used as the default
        one. It is also possible to click another point offset by providing ``focus`` argument.
    
        See ``CoordinateSystem`` for more details.
    
        Args:
            focus (2-:obj:`tuple`/2-:obj:`list`/:obj:`str`): an offset point (x, y) from the top left corner of the UI
             element(s), values must be in range of 0~1. This argument can be also specified by 'anchor' or 'center'.
             'Center' means to click the center of bounding box of UI element.
            sleep_interval: number of seconds to wait after this action. Default is None which is the default sleep
             interval. This value can be configured by Poco initialization. See configuration at poco
             :py:class:`initialization <poco.pocofw.Poco>` for more details.
    
        Raises:
            PocoNoSuchNodeException: raised when the UI element does not exist
        """
    
        focus = focus or self._focus or 'anchor'
        pos_in_percentage = self.get_position(focus)
        self.poco.pre_action('click', self, pos_in_percentage)
>       ret = self.poco.click(pos_in_percentage)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/poco/proxy.py:334: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <poco.drivers.ios.iosPoco object at 0x12b505f60>
pos = [0.25, 0.9476902173913043]

    def click(self, pos):
        """
        Perform click (touch, tap, etc.) action on target device at given coordinates.
    
        The coordinates (x, y) are either a 2-list or 2-tuple. The coordinates values for x and y must be in the
        interval between 0 ~ 1 to represent the percentage of the screen. For example, the coordinates ``[0.5, 0.5]``
        represent the `center` of the screen and the coordinates ``[0, 0]`` represent the `top left corner`.
    
        See ``CoordinateSystem`` for more details about coordinate system.
    
        Examples:
            Click the point of ``(100, 100)`` of screen which resolution is ``(1920, 1080)``::
    
                poco.click([100.0 / 1920, 100.0 / 1080])
    
        Args:
            pos (:obj:`list(float, float)` / :obj:`tuple(float, float)`): coordinates (x, y) in range of 0 to 1
    
        Raises:
            InvalidOperationException: when clicked outside of the screen
        """
    
        if not (0 <= pos[0] <= 1) or not (0 <= pos[1] <= 1):
            raise InvalidOperationException('Click position out of screen. pos={}'.format(repr(pos)))
>       ret = self.agent.input.click(pos[0], pos[1])

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/poco/pocofw.py:252: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <poco.utils.airtest.input.AirtestInput object at 0x12b572438>, x = 0.25
y = 0.9476902173913043

    def click(self, x, y):
        pw, ph = self._get_touch_resolution()
        pos = [x * pw, y * ph]
>       touch(pos, duration=self.default_touch_down_duration)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/poco/utils/airtest/input.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = ([310.5, 2092.5],), kwargs = {'duration': 0.01}
start = 1562856193.0460422
m = {'kwargs': {'duration': 0.01}, 'times': 1, 'v': [310.5, 2092.5]}
fndata = {'call_args': {'kwargs': {'duration': 0.01}, 'times': 1, 'v': [310.5, 2092.5]}, 'end_time': 1562856254.080986, 'name': 'touch', 'start_time': 1562856193.0460422, ...}
data = {'end_time': 1562856254.080986, 'traceback': 'Traceback (most recent call last):\n  File "/Users/ninebot/.local/share/...WDAError(r.status, r.value)\nwda.WDAError: WDAError(status=889, value=Application is not running, possibly crashed)\n'}

    @functools.wraps(f)
    def wrapper(*args, **kwargs):
        start = time.time()
        m = inspect.getcallargs(f, *args, **kwargs)
        fndata = {'name': f.__name__, 'call_args': m, 'start_time': start}
        logger.running_stack.append(fndata)
        try:
>           res = f(*args, **kwargs)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/airtest/utils/logwraper.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

v = [310.5, 2092.5], times = 1, kwargs = {'duration': 0.01}
pos = [310.5, 2092.5], _ = 0

    @logwrap
    def touch(v, times=1, **kwargs):
        """
        Perform the touch action on the device screen
    
        :param v: target to touch, either a Template instance or absolute coordinates (x, y)
        :param times: how many touches to be performed
        :param kwargs: platform specific `kwargs`, please refer to corresponding docs
        :return: finial position to be clicked
        :platforms: Android, Windows, iOS
        """
        if isinstance(v, Template):
            pos = loop_find(v, timeout=ST.FIND_TIMEOUT)
        else:
            try_log_screen()
            pos = v
        for _ in range(times):
>           G.DEVICE.touch(pos, **kwargs)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/airtest/core/api.py:262: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <airtest.core.ios.ios.IOS object at 0x12b5141d0>
args = ([310.5, 2092.5],), kwargs = {'duration': 0.01}

    def wrapper(self, *args, **kwargs):
        try:
            return func(self, *args, **kwargs)
        except WDAError as err:
            # 6 : Session does not exist
            if err.status == 6:
                self._fetchNewSession()
                return func(self, *args, **kwargs)
            else:
>               raise err

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/airtest/core/ios/ios.py:44: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <airtest.core.ios.ios.IOS object at 0x12b5141d0>
args = ([310.5, 2092.5],), kwargs = {'duration': 0.01}

    def wrapper(self, *args, **kwargs):
        try:
>           return func(self, *args, **kwargs)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/airtest/core/ios/ios.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <airtest.core.ios.ios.IOS object at 0x12b5141d0>, pos = (310.5, 2092.5)
duration = 0.01

    @retry_session
    def touch(self, pos, duration=0.01):
        # trans pos of click
        pos = self._touch_point_by_orientation(pos)
    
        # scale touch postion
        x, y = pos[0] * self._touch_factor, pos[1] * self._touch_factor
        if duration >= 0.5:
            self.session.tap_hold(x, y, duration)
        else:
>           self.session.tap(x, y)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/airtest/core/ios/ios.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <wda.Session object at 0x12cfa2a20>, x = 103.5, y = 697.5

    def tap(self, x, y):
>       return self.http.post('/wda/tap/0', dict(x=x, y=y))

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/wda/__init__.py:429: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <wda.HTTPClient object at 0x11aa40d68>, method = 'post'
url = '/wda/tap/0', data = {'x': 103.5, 'y': 697.5}

    def fetch(self, method, url, data=None):
>       return self._fetch_no_alert(method, url, data)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/wda/__init__.py:108: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <wda.HTTPClient object at 0x11aa40d68>, method = 'post'
url = '/wda/tap/0', data = {'x': 103.5, 'y': 697.5}, depth = 0

    def _fetch_no_alert(self, method, url, data=None, depth=0):
        target_url = urljoin(self.address, url)
        try:
>           return httpdo(target_url, method, data)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/wda/__init__.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://127.0.0.1:8100/session/483E83BE-C104-43A4-892F-67EA97531EEF/wda/tap/0'
method = 'post', data = '{"x": 103.5, "y": 697.5}'

    def httpdo(url, method='GET', data=None):
        """
        Do HTTP Request
        """
        start = time.time()
        if isinstance(data, dict):
            data = json.dumps(data)
        if DEBUG:
            print("Shell: curl -X {method} -d '{data}' '{url}'".format(method=method.upper(), data=data or '', url=url))
    
        try:
            response = requests.request(method, url, data=data, timeout=HTTP_TIMEOUT)
        except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout):
            # retry again
            # print('retry to connect, error: {}'.format(e))
            time.sleep(1.0)
            response = requests.request(method, url, data=data, timeout=HTTP_TIMEOUT)
    
        if DEBUG:
            ms = (time.time() - start) * 1000
            print('Return ({:.0f}ms): {}'.format(ms, response.text))
    
        try:
            retjson = response.json()
        except ValueError as e:
            # show why json.loads error
            raise ValueError(e, response.text)
    
        r = convert(retjson)
        if r.status != 0:
>           raise WDAError(r.status, r.value)
E           wda.WDAError: WDAError(status=889, value=Application is not running, possibly crashed)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/wda/__init__.py:90: WDAError

During handling of the above exception, another exception occurred:

args = (<test_01_legal_terms_dialog.TestLegalTermsDialog object at 0x11aa408d0>,)
kwargs = {'get_app': <common.IOSApp object at 0x12ae57828>, 'snapshot_writer': <conftest.SnapShotWriter object at 0x12ae574e0>}
result = None, file_name = '3q1z7f2f3m6h3a6d7l4o.png'
file_path = '/Users/ninebot/code/ninebotapp_v5_uiautotest/ios/allure-results/3q1z7f2f3m6h3a6d7l4o.png'

    @wraps(func)
    def wrapper(*args, **kwargs):
        result = None
        try:
            result = func(*args, **kwargs)
        except Exception as e:
            file_name = '{}.png'.format(generate_random_num_str())
            file_path = os.path.join(allure_results_dir, file_name)
>           device().snapshot(file_path)

cases/conftest.py:826: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/airtest/core/ios/ios.py:159: in snapshot
    data = self._neo_wda_screenshot()  # wda 截图不用考虑朝向
../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/airtest/core/ios/ios.py:143: in _neo_wda_screenshot
    value = self.driver.http.get('screenshot').value
../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/wda/__init__.py:108: in fetch
    return self._fetch_no_alert(method, url, data)
../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/wda/__init__.py:114: in _fetch_no_alert
    return httpdo(target_url, method, data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://127.0.0.1:8100/screenshot', method = 'get', data = None

    def httpdo(url, method='GET', data=None):
        """
        Do HTTP Request
        """
        start = time.time()
        if isinstance(data, dict):
            data = json.dumps(data)
        if DEBUG:
            print("Shell: curl -X {method} -d '{data}' '{url}'".format(method=method.upper(), data=data or '', url=url))
    
        try:
            response = requests.request(method, url, data=data, timeout=HTTP_TIMEOUT)
        except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout):
            # retry again
            # print('retry to connect, error: {}'.format(e))
            time.sleep(1.0)
            response = requests.request(method, url, data=data, timeout=HTTP_TIMEOUT)
    
        if DEBUG:
            ms = (time.time() - start) * 1000
            print('Return ({:.0f}ms): {}'.format(ms, response.text))
    
        try:
            retjson = response.json()
        except ValueError as e:
            # show why json.loads error
            raise ValueError(e, response.text)
    
        r = convert(retjson)
        if r.status != 0:
>           raise WDAError(r.status, r.value)
E           wda.WDAError: WDAError(status=889, value=Application is not running, possibly crashed)

../../../.local/share/virtualenvs/ios-0VTi9OyE/lib/python3.6/site-packages/wda/__init__.py:90: WDAError

StandOutstar avatar Jul 26 '19 11:07 StandOutstar

目前切换到 xcode 10.1 是没有这个问题的,但是由于开发们所用的是 10.2 版本,所以还是希望 10.2 版本上可以稳定使用

你好,我xcode 10.2 也是报了这个问题,10.1稳定吗,没有这个问题吗?

1111111Aa avatar Nov 19 '19 08:11 1111111Aa

你好,我想问下,启动APP的时候出现了报这样的错,请问你的问题有解决吗

vivian12 avatar Aug 11 '20 12:08 vivian12