Skip to content

Commit 53188a1

Browse files
authored
Merge pull request #354 from js361014/delete_file
Added file deleting support for Android
2 parents b6c141d + c5a2eca commit 53188a1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

AppiumLibrary/keywords/_android_utils.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,24 @@ def push_file(self, path, data, encode=False):
8585
data = base64.b64encode(data).decode('utf-8')
8686
driver.push_file(path, data)
8787

88+
def delete_file(self, path, timeout=5000, include_stderr=True):
89+
"""Delete the file specified as `path`.
90+
91+
Android only.
92+
93+
- _path_ - the path on the device
94+
- _timeout_ - delete command timeout
95+
- _includeStderr_ - whether exception will be thrown if the command's
96+
return code is not zero
97+
"""
98+
driver = self._current_application()
99+
driver.execute_script('mobile: shell', {
100+
'command': 'rm',
101+
'args': [path],
102+
'includeStderr': include_stderr,
103+
'timeout': timeout
104+
})
105+
88106
def get_activity(self):
89107
"""Retrieves the current activity on the device.
90108

0 commit comments

Comments
 (0)