def setUp(self): # check monitor running status if self.mon and not self.mon.running_status: self.skipTest('process monitor stop') self.d = AutomationDevice().get_device() self.account = Account(self.d) self.mouse = AdbMouse() self.adb_tools = AdbTools() self.BaseImagePath = os.path.join( os.path.abspath(os.path.dirname("__file__")), "dependency", "BaseImage") self.FailureIamgePath = os.path.join( os.path.abspath(os.path.dirname("__file__")), "test-reports", "FailureImage") self.TmpImagePath = os.path.join( os.path.abspath(os.path.dirname("__file__")), "test-reports", "TmpImage") if not os.path.exists(self.TmpImagePath): os.mkdir(self.TmpImagePath) if not os.path.exists(os.path.join(self.TmpImagePath, "croped")): os.mkdir(os.path.join(self.TmpImagePath, "croped")) self.account.sleep() self.account.wakeup() self.account.login() closeButton = self.d(resourceId="android:id/pc_close", className="android.widget.ImageView", packageName="com.android.browser") if closeButton.exists: logger.debug('click close button: (%s)' % (closeButton.info['packageName'])) closeButton.click() self.adb_tools.adb_shell('am force-stop com.android.browser')