我想使用uiautomatorandroid中的工具打开wifi作为测试用例的一部分.我尝试在uiautomator测试用例中使用以下代码:
WifiManager wi = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
if(wi.isWifiEnabled()){
wi.setWifiEnabled(false);
}else{
wi.setWifiEnabled(true);
}
Run Code Online (Sandbox Code Playgroud)
但它给出了这个错误:
Mainclass的"getSystemservice"方法未定义