예제 #1
0
def launch(app=None, udid=None, verbose=False):
    if app:
        client = Appium(app, udid, verbose)
        client.start()

        utils = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             "js/interpreter_utils.js")
        with open(utils) as file:
            js = "".join(file.read().splitlines())
        print client.proxy(js)[0][1]

        print ""
        print "Enter UIAutomation Command (type 'quit' to quit):"

        try:
            while True:
                line = raw_input('> ')

                if line == 'quit':
                    client.stop()
                    break

                response = client.proxy(line)
                try:
                    print response[0][1]
                except:
                    print response
        except KeyboardInterrupt:
            pass
    else:
        raise "ERROR: No app specified"
예제 #2
0
def launch(app=None, udid=None):
    if app:
        client = Appium(app, udid)
        client.start()
        
        utils = os.path.join(os.path.dirname(os.path.realpath(__file__)),
            "js/interpreter_utils.js")
        with open(utils) as file:
            js = "".join(file.read().splitlines())
        print client.proxy(js)[0][1]

        print ""
        print "Enter UIAutomation Command (type 'quit' to quit):"

        try:
            while True:
                line = raw_input('> ')

                if line == 'quit':
                    client.stop()
                    break

                response = client.proxy(line)
                try:
                    print response[0][1]
                except:
                    print response
        except KeyboardInterrupt:
            pass
    else:
        raise "ERROR: No app specified"
예제 #3
0
def launch(app=None):
    if app:
        client = Appium(app)
        client.start()

        print ""
        print "Enter UIAutomation Command (type 'quit' to quit):"

        try:
            while True:
                line = raw_input('> ')

                if line == 'quit':
                    client.stop()
                    break

                response = client.proxy(line)
                try:
                    print response[0][1]
                except:
                    print response
        except KeyboardInterrupt:
            pass
    else:
        raise "ERROR: No app specified"
예제 #4
0
def launch(app=None):
    if app: 
        client = Appium(app) 
        client.start() 

        print ""
        print "Enter UIAutomation Command (type 'quit' to quit):"

        try:
            while True:
                line = raw_input('> ')

                if line == 'quit':
                    client.stop()
                    break

                response = client.proxy(line)
                try:
                    print response[0][1]
                except:
                    print response
        except KeyboardInterrupt:
            pass 
    else:
        raise "ERROR: No app specified"
예제 #5
0
        'value': len(local_storage[session_id].keys())
    }


if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(
        description=
        'A webdriver-compatible server for use with native and hybrid iOS applications.'
    )
    parser.add_argument(
        'app',
        type=str,
        help=
        'path to simulators .app file or the bundle_id of the desired target on device'
    )
    parser.add_argument('-U',
                        '--UDID',
                        type=str,
                        help='unique device identifier of the SUT')
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=4723,
                        help='port to listen on')

    args = parser.parse_args()
    app.ios_client = Appium(args.app, args.UDID)
    run(app, host='0.0.0.0', port=args.port)
예제 #6
0
            ios_request = "elements['%s'] = wd_frame.%s[%s]" % (var_name, elements[element_type], i)
            print ios_request

            ios_response = app.ios_client.proxy(ios_request)
            print ios_response
            found_elements.append({'ELEMENT':var_name})
    except:
        response.status = 400
        status = 13  # UnknownError
    response = {'sessionId': '1', 
                'status': status, 
                'value': found_elements}
    return response 

if __name__ == '__main__':
    import sys
    if len(sys.argv) == 2:
        path_to_app = sys.argv[1]
        app.ios_client = Appium(path_to_app)
        app.ios_client.start() 
        run(app, host='0.0.0.0', port=4723)
    else:
      print """
  Appium - iOS App Automation 
       
  Usage: 
    When run as a script, include the absolute path to an app:
    $ python server.py ~/somethingawesome.app
  """

예제 #7
0
                        help='robot usb address (e.g. /dev/tty.usbmodem0)')
    parser.add_argument('-c',
                        '--robot_calibration_file',
                        type=str,
                        default=None,
                        help='robot calibration file')
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=4723,
                        help='port to listen on')

    args = parser.parse_args()

    # setup appium
    app.ios_client = Appium(args.app, args.UDID, args.verbose)

    # setup robot (if necessary)
    app.robot_usb_address = args.robot_usb_address
    app.robot_calibration_file = args.robot_calibration_file
    app.uses_robot = app.robot_usb_address is not None
    if app.uses_robot:
        if args.UDID is None:
            raise Exception(
                'Robots cannot be used with the simulator, please supply a UDID'
            )

        # TODO fix package situation so proper imports can be done
        botpath = os.path.abspath(
            os.path.join(
                os.path.split(os.path.abspath(__file__))[0], 'robot',