MCPcopy
hub / github.com/appium/python-client / get_device_time

Method get_device_time

appium/webdriver/extensions/device_time.py:41–63  ·  view source on GitHub ↗

Returns the date and time from the device. Args: format: The set of format specifiers. Read https://momentjs.com/docs/ to get the full list of supported datetime format specifiers. If unset, return :func:`.device_time` as default format is `YYYY-

(self, format: Optional[str] = None)

Source from the content-addressed store, hash-verified

39 return self.mark_extension_absence(ext_name).execute(Command.GET_DEVICE_TIME_GET, {})['value']
40
41 def get_device_time(self, format: Optional[str] = None) -> str:
42 """Returns the date and time from the device.
43
44 Args:
45 format: The set of format specifiers. Read https://momentjs.com/docs/
46 to get the full list of supported datetime format specifiers.
47 If unset, return :func:`.device_time` as default format is `YYYY-MM-DDTHH:mm:ssZ`,
48 which complies to ISO-8601
49
50 Usage:
51 | self.driver.get_device_time()
52 | self.driver.get_device_time("YYYY-MM-DD")
53
54 Return:
55 str: The date and time
56 """
57 ext_name = 'mobile: getDeviceTime'
58 if format is None:
59 return self.device_time
60 try:
61 return self.assert_extension_exists(ext_name).execute_script(ext_name, {'format': format})
62 except UnknownMethodException:
63 return self.mark_extension_absence(ext_name).execute(Command.GET_DEVICE_TIME_POST, {'format': format})['value']
64
65 def _add_commands(self) -> None:
66 self.command_executor.add_command(

Callers 2

test_get_device_timeMethod · 0.80

Calls 4

execute_scriptMethod · 0.80
executeMethod · 0.45

Tested by 2

test_get_device_timeMethod · 0.64