docs: Added Ruby and Python for audio capture, add mobile command (#14321)

* docs: Added Ruby and Python for audio capture, add mobile command

* fix ruby

* fix sleep in python
This commit is contained in:
Kazuaki Matsuo
2020-05-12 11:11:43 +09:00
committed by GitHub
parent 502ffe88ee
commit 8fa295dfd0
2 changed files with 18 additions and 0 deletions
+2
View File
@@ -63,6 +63,8 @@
| mobile:getAppearance | Get the device's UI appearance style via `xcrun simctl ui`. It returns `light`, `dark`, `unknown` or `unsupported` (below iOS 12). |||
| mobile:setAppearance | Set the device's UI appearance style via `xcrun simctl ui` or Siri command. | `{style}` | `{style: 'dark'}` |
| mobile:getDeviceTime | Get time of the device under test. https://momentjs.com/docs/ is the full list of supported datetime format specifiers. Defaults to `YYYY-MM-DDTHH:mm:ssZ` which is ISO-8601. | `{format}` | `{format: 'YYYY-MM'}` |
| mobile:startAudioRecording | Start recording audio stream. Read [Audio Capture From iOS Simulators and Real Devices](/docs/en/writing-running-appium/ios/audio-capture.md) for more details | | |
| mobile:stopAudioRecording | Stop and store the recording audio stream. Read [Audio Capture From iOS Simulators and Real Devices](/docs/en/writing-running-appium/ios/audio-capture.md) for more details | | |
### Android
| Command | Description | Argument | Argument Example |
@@ -42,6 +42,22 @@ try (FileOutputStream fos = new FileOutputStream("out.mp4")) {
}
```
```ruby
# Ruby
@driver.execute_script 'mobile: startAudioRecording', audioInput: ':0'
sleep 10
base64_str = @driver.execute_script 'mobile: stopAudioRecording'
File.write 'out.mp4', Base64.decode64(base64_str)
```
```python
# Python
driver.execute_script('mobile: startAudioRecording', {'audioInput': ':1'})
time.sleep(10)
base64_str = driver.execute_script('mobile: stopAudioRecording')
with open('out.mp4', 'wb') as f:
f.write(base64.b64decode(base64_str))
```
### Server Requirements