Appium+python自动化测试过程中问题

文章描述了在使用Appium进行自动化测试时遇到的两个问题:一是尝试启动contactmanager应用时因应用被自动删除导致的错误,二是新的测试会话无法创建因为已有会话在进行。解决方案包括检查应用是否可启动,设置Appium覆盖Session以及在测试结束后正确关闭会话。
摘要由CSDN通过智能技术生成

一、自动删除contactmanager

自动化测试appium提供的sample如下包/activity:com.example.android.contactmanager/.ContactManager ,发现提示如下错误

info: [debug] Error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity

at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1146:21)
at [object Object].<anonymous> (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)

info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity)”,“origValue”:“Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 2518.066 ms - 346

发现提示该包不存在。很奇怪我安装了之后确认能够运行了之后再运行的自动化代码,为什么提示不存在呢?

于是观察模拟器运行界面信息,发现启动代码后自动把模拟器中的contactmanager删除了,那当然找不到这个包和activity啦。

二、Failed to start an Appium session, err was: Error: Requested a new session but one was in progress

在这里插入图片描述
这是由于之前的会话没有关闭,然后你又开启了测试实例,解决方法:

  1. 停止appium服务
  2. 在Genarel Setting那里设置覆盖Session,重启Appium

测试结束在AfterClass加driver.quit()

在这里插入图片描述
最后:下方这份完整的【软件测试】视频学习教程已经整理上传完成,朋友们如果需要可以自行免费领取 【保证100%免费】

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值