配置的testcase和黑名单未生效

想问下,我这边在配置testcase用于启动后进行自动登陆操作,同时该页面部分按钮添加到了黑明单(用不到的控件),但是testcase没生效,且黑明单也没生效,点击了黑名单控件

  • 现象:登陆页面输入框一直没响应,会进入到黑明单控件,运行一段时间后进入桌面会启动其他App。

  • 日志文件如下:
    appcrawler_login.log (3.2 MB)

  • yml配置文件如下:

---
pluginList: []
saveScreen: true
reportTitle: ""
resultDir: "20210930152311"
waitLoading: 500
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 10
capability:
  noReset: "true"
  fullReset: "false"
  appium: "http://127.0.0.1:4723/wd/hub"
  appPackage: "com.jlpay.merch"
  appActivity: ".ui.start.SplashActivity"
testcase:
  name: "XueQiuTestDemo AppCrawler"
  steps:
  - given: []
    when: 
    xpath: "//*[@resource-id='com.jlpay.merch:id/et_login_account']"
    action: "84931015812A00N"
    when: 
    xpath: " //*[@resource-id='com.jlpay.merch:id/et_login_password']"
    action: "123456Aa"
    when: 
    xpath: "//*[@resource-id='com.jlpay.merch:id/btn_login']"
    action: click
    when: 
    xpath: "//*[@resource-id='com.jlpay.merch:id/btn_confirm']"
    action: click

  # - { xpath: "//*[@resource-id='com.xueqiu.android:id/et_login_account']", action: "84931015812A00N" }
  # - { xpath: "//*[@resource-id='com.xueqiu.android:id/et_login_password']", action: "123456Aa" }
  # - { xpath: "//*[@resource-id='com.xueqiu.android:id/btn_login']", action: click}
  # - { xpath: "//*[@resource-id='com.xueqiu.android:id/btn_confirm']", action: click }
selectedList:
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Button')]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Text') and @clickable='true' and string-length(@text)<10]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[@clickable='true']/*[contains(name(), 'Text') and string-length(@text)<10]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Image') and @clickable='true']"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[@clickable='true']/*[contains(name(), 'Image')]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Image') and @name!='']"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Text') and @name!='' and string-length(@label)<10]"
  action: null
  actions: []
  times: 0
firstList: []
lastList:
- given: []
  when: null
  then: []
  xpath: "//*[@selected='true']/..//*"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[@selected='true']/../..//*"
  action: null
  actions: []
  times: 0
backButton:
- given: []
  when: null
  then: []
  xpath: "Navigate up"
  action: null
  actions: []
  times: 0
triggerActions:
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn"
  action: null
  actions: []
  times: 0
xpathAttributes:
- "name"
- "label"
- "value"
- "resource-id"
- "content-desc"
- "instance"
- "text"
sortByAttribute:
- "depth"
- "list"
- "selected"
findBy: "default"
defineUrl: []
baseUrl: []
appWhiteList: []
urlBlackList: []
urlWhiteList: []
blackList:
- xpath: "//*[@resource-id='com.jlpay.merch:id/tv_login_type']"
- xpath: "//*[@resource-id='com.jlpay.merch:id/tv_forget_password']"
- xpath: "//*[@resource-id='com.jlpay.merch:id/ll_apply_account']"
- xpath: "//*[@resource-id='com.jlpay.merch:id/ll_login_group']"
beforeRestart: []
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(500)"
  actions: []
  times: 0
afterElement: []
afterPage: []
afterPageMax: 2
tagLimitMax: 2
tagLimit:
- given: []
  when: null
  then: []
  xpath: "确定"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "取消"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn_name"
  action: null
  actions: []
  times: 1000
assertGlobal: []

你这个日志好像不是 appcrawler 的

那是全部的日志,我写到一个 文件中了。另外,我这边目前跑通了,用带大括号的简写形式,主要修改点包括testcase和blackList两处,配置如下:

  • testcase配置:
testcase:
  name: "TesterHome AppCrawler"
  steps:
  - { xpath: "//*[@resource-id='com.jlpay.merch:id/et_login_account']", action: "84931015812A00N" }
  - { xpath: "//*[@resource-id='com.jlpay.merch:id/et_login_password']", action: "123456Aa" }
  - { xpath: "//*[@resource-id='com.jlpay.merch:id/btn_login']", action: click}
  - { xpath: "//*[@resource-id='com.jlpay.merch:id/btn_confirm']", action: click }

  • blackList配置:
blackList:
- xpath: //*[@resource-id='com.xueqiu.android:id/tv_login_type']
- xpath: //*[@resource-id='com.xueqiu.android:id/tv_forget_password']
- xpath: //*[@resource-id='com.xueqiu.android:id/ll_apply_account']
- xpath: //*[@resource-id='com.xueqiu.android:id/tv_login_group']
- xpath: //*[@resource-id='com.xueqiu.android:id/tv_collect']
- xpath: //*[@resource-id='com.xueqiu.android:id/btn_loginout']
- xpath: //*[@resource-id='com.xueqiu.android:id/rl_business_loan']

疑问:网上的文章中各类格式都有,我有个疑问:xpath 后面的值什么时候需要用双引号,什么时候直接输入值就行?而且blackList 我用官网配置文件配置成如下不带xpath 的形式定位不了,不清楚是什么原因,请解答一下,谢谢。

blackList:
#排除掉ios的状态栏
- "//*[contains(name(), 'StatusBar')]//*"
#股票分组编辑. 同一个imageview有2个图代表不同的状态. 没法区分, 只能设置为黑名单
- //*[@resource-id='com.xueqiu.android:id/edit_group']
- ".*Safari"
- ".*电话.*"
- ".*Safari.*"
- "发布"
- "action_bar_title"
- ".*浏览器.*"
- "message"
- ".*home"
- "首页"
- "Photos"
- "地址"
- "网址"
- "拉黑"
- "举报"
- "camera"
- "Camera"