def set_gsm_signal(self: T, strength: int) -> T: """Set GSM signal strength (Emulator only) Android only. Args: strength: Signal strength. A member of the enum :obj:`appium.webdriver.extensions.android.gsm.GsmSignalStrength` Usage: self.driver.set_gsm_signal(GsmSignalStrength.GOOD) Returns: Union['WebDriver', 'Gsm']: Self instance """ constants = extract_const_attributes(GsmSignalStrength) if strength not in constants.values(): logger.warning( f'{strength} is out of range. Consider using one of {list(constants.keys())} constants. ' f'(e.g. {GsmSignalStrength.__name__}.GOOD)') self.execute(Command.SET_GSM_SIGNAL, { 'signalStrength': strength, 'signalStrengh': strength }) return self
def make_gsm_call(self: T, phone_number: str, action: str) -> T: """Make GSM call (Emulator only) Android only. Args: phone_number: The phone number to call to. action: The call action. A member of the const `appium.webdriver.extensions.android.gsm.GsmCallActions` Usage: self.driver.make_gsm_call('5551234567', GsmCallActions.CALL) Returns: Union['WebDriver', 'Gsm']: Self instance """ constants = extract_const_attributes(GsmCallActions) if action not in constants.values(): logger.warning( f'{action} is unknown. Consider using one of {list(constants.keys())} constants. ' f'(e.g. {GsmCallActions.__name__}.CALL)') self.execute(Command.MAKE_GSM_CALL, { 'phoneNumber': phone_number, 'action': action }) return self
def set_gsm_voice(self, state): """Set GSM voice state (Emulator only) Android only. :Args: - state(str): State of GSM voice - GsmVoiceState.UNREGISTERED/HOME/ROAMING/SEARCHING/DENIED/OFF/ON :Usage: self.driver.set_gsm_voice(GsmVoiceState.HOME) """ constants = extract_const_attributes(GsmVoiceState) if state not in constants.values(): logger.warning('{} is unknown. Consider using one of {} constants. (e.g. {}.HOME)'.format( state, list(constants.keys()), GsmVoiceState.__name__)) self.execute(Command.SET_GSM_VOICE, {'state': state}) return self
def set_gsm_signal(self, strength): """Set GSM signal strength (Emulator only) Android only. :Args: - strength (int): Signal strength - GsmSignalStrength.NONE_OR_UNKNOWN/POOR/MODERATE/GOOD/GREAT :Usage: self.driver.set_gsm_signal(GsmSignalStrength.GOOD) """ constants = extract_const_attributes(GsmSignalStrength) if strength not in constants.values(): logger.warning('{} is out of range. Consider using one of {} constants. (e.g. {}.GOOD)'.format( strength, list(constants.keys()), GsmSignalStrength.__name__)) self.execute(Command.SET_GSM_SIGNAL, {'signalStrength': strength, 'signalStrengh': strength}) return self
def make_gsm_call(self, phone_number, action): """Make GSM call (Emulator only) Android only. :Args: - phone_number (str): The phone number to call to. - action (str): The call action - GsmCallActions.CALL/ACCEPT/CANCEL/HOLD :Usage: self.driver.make_gsm_call('5551234567', GsmCallActions.CALL) """ constants = extract_const_attributes(GsmCallActions) if action not in constants.values(): logger.warning('{} is unknown. Consider using one of {} constants. (e.g. {}.CALL)'.format( action, list(constants.keys()), GsmCallActions.__name__)) self.execute(Command.MAKE_GSM_CALL, {'phoneNumber': phone_number, 'action': action}) return self
def set_gsm_voice(self, state): """Set GSM voice state (Emulator only) Android only. :Args: - state(str): State of GSM voice. A member of the const appium.webdriver.extensions.android.gsm.GsmVoiceState :Usage: self.driver.set_gsm_voice(GsmVoiceState.HOME) """ constants = extract_const_attributes(GsmVoiceState) if state not in constants.values(): logger.warning( '{} is unknown. Consider using one of {} constants. (e.g. {}.HOME)' .format(state, list(constants.keys()), GsmVoiceState.__name__)) self.execute(Command.SET_GSM_VOICE, {'state': state}) return self
def set_network_speed(self, speed_type): """Set the network speed emulation. Android Emulator only. :Args: - speed_type (str): The network speed type. A member of the const appium.webdriver.extensions.android.network.NetSpeed. :Usage: self.driver.set_network_speed(NetSpeed.LTE) """ constants = extract_const_attributes(NetSpeed) if speed_type not in constants.values(): logger.warning('{} is unknown. Consider using one of {} constants. (e.g. {}.LTE)'.format( speed_type, list(constants.keys()), NetSpeed.__name__)) self.execute(Command.SET_NETWORK_SPEED, {'netspeed': speed_type}) return self
def set_gsm_signal(self, strength): """Set GSM signal strength (Emulator only) Android only. :Args: - strength (int): Signal strength. A member of the enum appium.webdriver.extensions.android.gsm.GsmSignalStrength :Usage: self.driver.set_gsm_signal(GsmSignalStrength.GOOD) """ constants = extract_const_attributes(GsmSignalStrength) if strength not in constants.values(): logger.warning( '{} is out of range. Consider using one of {} constants. (e.g. {}.GOOD)' .format(strength, list(constants.keys()), GsmSignalStrength.__name__)) self.execute(Command.SET_GSM_SIGNAL, { 'signalStrength': strength, 'signalStrengh': strength }) return self
def set_gsm_voice(self: T, state: str) -> T: """Set GSM voice state (Emulator only) Android only. Args: state: State of GSM voice. A member of the const `appium.webdriver.extensions.android.gsm.GsmVoiceState` Usage: self.driver.set_gsm_voice(GsmVoiceState.HOME) Returns: Union['WebDriver', 'Gsm']: Self instance """ constants = extract_const_attributes(GsmVoiceState) if state not in constants.values(): logger.warning( f'{state} is unknown. Consider using one of {list(constants.keys())} constants. ' f'(e.g. {GsmVoiceState.__name__}.HOME)') self.execute(Command.SET_GSM_VOICE, {'state': state}) return self
def set_network_speed(self: T, speed_type: str) -> T: """Set the network speed emulation. Android Emulator only. Args: speed_type: The network speed type. A member of the const appium.webdriver.extensions.android.network.NetSpeed. Usage: self.driver.set_network_speed(NetSpeed.LTE) Returns: Union['WebDriver', 'Network']: Self instance """ constants = extract_const_attributes(NetSpeed) if speed_type not in constants.values(): logger.warning( f'{speed_type} is unknown. Consider using one of {list(constants.keys())} constants. ' f'(e.g. {NetSpeed.__name__}.LTE)') self.execute(Command.SET_NETWORK_SPEED, {'netspeed': speed_type}) return self