51Testing软件测试论坛

标题: Appium问题集合 [打印本页]

作者: 八戒你干嘛    时间: 2019-1-15 15:15
标题: Appium问题集合
uiautomatorviewer和appium无法捕获App页面报错

uiautomatorviewer报错

  1. Error obtaining ui hierarchy
  2. Reason:
  3. error taking device screenshot:EOF
复制代码

appium报错

  1. App Source Could not obtain source: [object Object]
复制代码

appium server日志报错

  1. Error: Cannot get screenshot data because of 'The size of the taken screenshot equals to zero.'. Make sure the 'LayoutParams.FLAG_SECURE' is not set for the current view
复制代码
原因

App页面已经被禁止截屏,禁用用户截屏的代码如下:

  1. getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
  2. setContentView(R.layout.activity_main);
  3. 解决
复制代码

执行代码,进入该页面,通过String source = driver.getPageSource();获取该页面的dom,通过dom找到需要定位的元素







欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2