Beispiel #1
0
 def quit(self):
     if self.isRunning():
         atomac.terminateAppByBundleId(self.bid)
         while(self.isRunning()):
             time.sleep(0.5)       
         return True
     else:
         return False
Beispiel #2
0
def close_app(cbundleID):
    '''To close the app and kill the process '''
    try:
        logger("[+] Closing the "+cbundID+"app")
        atomac.terminateAppByBundleId(cbundleID)
        logger("Force killing  the process with signal")
        os.system("ps -eaf|grep -i 'Notes'|grep -v grep|awk '{print $2}'|xargs kill ")
        time.sleep(3)
    except Exception as er:
        logger("[-] Exception while opening the app")
        logger("[-] Error @open_app is "+str(er))
def close_app(bundle_id=None):
	""" to close the application using bundle id  """
	if not bundle_id:
			log.debug('BundleId value is empty - %s' % bundle_id)
			return 0
	try:
		atomac.terminateAppByBundleId(bundle_id)
		time.sleep(2)
		return 1
	except Exception:
		log.error('Exception caught while closing app', exc_info=True)
		return 0
    def check_installation(cls):
        found = 0
        cmd = 'open -a Firefox'

        log.info("[Firefox] Starting firefox...")

        if not cls.run(cmd):
            log.info("[Firefox] Failed to open firefox")
            return 0

        try:
            firefox = atomac.getAppRefByBundleId(BID_FIREFOX)
            found = 1
            firefox.activate()
            sleep(5)
            capture_screen('firefox_install_success')
            sleep(2)
            atomac.terminateAppByBundleId(BID_FIREFOX)
            log.info("[Firefox] Firefox launched successfully!")
        except ValueError:
            log.error("[Firefox] Firefox not running!")

        return found
    signInBtn = currentWindow.findFirstR(AXRole='AXButton', AXTitle='Sign In')
    signInBtn.Press()
    wait_login_screen(15)


if __name__ == "__main__":
    args = sys.argv
    loopNumber = 2
    if len(args) == 2:
        loopNumber = int(args[1])
    elif len(args) > 2:
        print 'input error, e.g. python auto_login.py [loopNumber]'
        quit()

    print 'loop for %d times' % loopNumber
    atomac.terminateAppByBundleId('us.zoom.ringcentral')
    time.sleep(3)
    launch_app()

    index = 0
    while index < loopNumber:
        print '******* index: ' + str(index)
        currentWindow = automator.windows()[0]
        phoneNumberField = currentWindow.findFirstR(AXRole='AXTextField', AXPlaceholderValue='Phone Number')
        # extField = currentWindow.findFirstR(AXRole='AXTextField', AXPlaceholderValue='Ext')
        passwordField = currentWindow.findFirstR(AXRole='AXTextField', AXPlaceholderValue='Password')
        loginBtn = currentWindow.findFirstR(AXRole='AXButton', AXTitle='Login')
        # time.sleep(5)
        # change country
        i = index % len(country_name_dict)
        country_name = country_name_dict.keys()[i]
Beispiel #6
0
    sys.exit (1)

#--- Check transient prefs string
expectedValue = '<' + newPrefsValue + '>'
if transientPrefsString.AXValue != expectedValue:
    print '*** Erreur 3 ***'
    sys.exit (1)

#--- Check resulting string
expectedValue = 'Doc \'' + newDocumentValue + '\' Prefs \'' + newPrefsValue + '\' Pref Transient \'<' + newPrefsValue + '>\''
if resultingString.AXValue != expectedValue:
    print '*** Erreur 4 ***'
    sys.exit (1)

#--- Quit
atomac.terminateAppByBundleId (bundleName)
time.sleep(.5)

#--- Lauch again application
ok = AppKit.NSWorkspace.sharedWorkspace().openFile_ (sourceFilePath) 
if not ok:
    print '*** Erreur 10 ***'
    sys.exit (1)

monAppli = atomac.getAppRefByBundleId (bundleName)
time.sleep (0.5)

documentWindow = monAppli.windows () [0]
documentString = documentWindow.findFirst (AXDescription='documentString')
transientPrefsString = documentWindow.findFirst (AXDescription='transientPrefsString')
resultingString = documentWindow.findFirst (AXDescription='resultingString')
Beispiel #7
0
def quitApplication():
    atomac.terminateAppByBundleId('fr.irccyn.molinaro.hidden-binding')
    time.sleep(0.5)
Beispiel #8
0
 def terminate():
     atomac.terminateAppByBundleId(BUNDLE)
     time.sleep(2)
Beispiel #9
0
def quitApplication(Bundleid):
    atomac.terminateAppByBundleId(Bundleid)
Beispiel #10
0
def quitApplication():
    atomac.terminateAppByBundleId('fr.irccyn.molinaro.simple-preferences')
    time.sleep(0.5)
Beispiel #11
0
 def delete(self):
     if self._should_terminate_app:
         atomac.terminateAppByBundleId(self._bundle_id)
Beispiel #12
0
def quitApplication():
    atomac.terminateAppByBundleId('fr.irccyn.molinaro.transient-property')
    time.sleep(0.5)