appium定位H5页面

手机端由原生切换为H5,定位不到元素。需要将apk开启调试模式:在入口Activity中添加2行代码,如下
if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}

效果如下:
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
super.onCreate(savedInstanceState);
context = this;
if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
   ......
......

转载于:https://www.cnblogs.com/jdm532000/p/9668335.html

你可能感兴趣的:(python,测试)