uiautomatorviewer和appium无法捕获App页面报错 uiautomatorviewer报错 - Error obtaining ui hierarchy
- Reason:
- error taking device screenshot:EOF
复制代码appium报错 - App Source Could not obtain source: [object Object]
复制代码appium server日志报错 - 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页面已经被禁止截屏,禁用用户截屏的代码如下: - getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
- setContentView(R.layout.activity_main);
- 解决
复制代码执行代码,进入该页面,通过String source = driver.getPageSource();获取该页面的dom,通过dom找到需要定位的元素
|