• 话说:driver.terminate_app("com.xxx.xxx") 这个是官方推荐的终止 APP 方法,, 这些信息大佬都是在哪里看到的

  • 没错,我最后就是用的这个方法,想问下大佬最近有没有用过 appium2,感觉好容易闪退啊,不知道有没有遇到过

  • 这个问题确实如你所说,我用其他方式处理了, 顺便想问下大佬最近有没有用过 appium2,感觉好容易闪退啊,不知道有没有遇到过

  • 感谢大佬!

  • 
    test_case/test_login.py:18 (TestLogin.test_login[RenphoHealth-account_data0])
    request = <SubRequest 'init_driver' for <Function test_login[RenphoHealth-account_data0]>>
    
        @pytest.fixture()
        def init_driver(request):
            # 前置
            driver = webdriver.Remote(appium_server_url, options=AppiumOptions().load_capabilities(capabilities))
            # 使用Allure的attach方法将配置信息作为文本附件添加到报告中
            attach_name = "Appium Configuration"
            attach_content = "\n".join([f"{key}: {value}" for key, value in capabilities.items()])
            allure.attach(attach_content, name=attach_name, attachment_type=allure.attachment_type.TEXT)
    
            yield driver
            # 后置
    >       driver.close()
    
    conftest.py:53: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:459: in close
        self.execute(Command.CLOSE)
    /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:348: in execute
        self.error_handler.check_response(response)
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    self = <appium.webdriver.errorhandler.MobileErrorHandler object at 0x1037ed990>
    response = {'status': 404, 'value': '{"value":{"error":"unknown command","message":"The requested resource could not be found, or...tory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)\\n\\tat java.lang.Thread.run(Thread.java:1012)\\n"}}'}
    
        def check_response(self, response: Dict[str, Any]) -> None:
            """
            https://www.w3.org/TR/webdriver/#errors
            """
            payload = response.get('value', '')
            if isinstance(payload, dict):
                payload_dict = payload
            else:
                try:
                    payload_dict = json.loads(payload)
                except (json.JSONDecodeError, TypeError):
                    return
                if not isinstance(payload_dict, dict):
                    return
            value = payload_dict.get('value')
            if not isinstance(value, dict):
                return
            error = value.get('error')
            if not error:
                return
    
            message = value.get('message', error)
            stacktrace = value.get('stacktrace', '')
            # In theory, we should also be checking HTTP status codes.
            # Java client, for example, prints a warning if the actual `error`
            # value does not match to the response's HTTP status code.
            exception_class: Type[sel_exceptions.WebDriverException] = ERROR_TO_EXC_MAPPING.get(
                error, sel_exceptions.WebDriverException
            )
            if exception_class is sel_exceptions.WebDriverException and message:
                if message == 'No such context found.':
                    exception_class = appium_exceptions.NoSuchContextException
                elif message == 'That command could not be executed in the current context.':
                    exception_class = appium_exceptions.InvalidSwitchToTargetException
    
            if exception_class is sel_exceptions.UnexpectedAlertPresentException:
                raise sel_exceptions.UnexpectedAlertPresentException(
                    msg=message,
                    stacktrace=format_stacktrace(stacktrace),
                    alert_text=value.get('data'),
                )
    >       raise exception_class(msg=message, stacktrace=format_stacktrace(stacktrace))
    E       selenium.common.exceptions.UnknownMethodException: Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    E       Stacktrace:
    E       io.appium.uiautomator2.common.exceptions.UnknownCommandException: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    E           at io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:84)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
    E           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
    E           at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
    E           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
    E           at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:435)
    E           at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
    E           at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
    E           at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:250)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
    E           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
    E           at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
    E           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)
    E           at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)
    E           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)
    E           at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
    E           at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
    E           at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:611)
    E           at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:552)
    E           at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:466)
    E           at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
    E           at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
    E           at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
    E           at java.lang.Thread.run(Thread.java:1012)
    
    
  • 上面发了


  • 这是我的 caps 其实主要就是 appium:noReset: false

  • 真的没人吗 555

  • Win 下成功 Appium+iOS 自动化 at 2024年01月15日

    @Morii 大佬 我遇到一样的问题,请问你是怎么解决的

  • 可是 塔底大不大 塔尖就这么大啊