|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +from selenium import webdriver |
| 16 | +from ..mobilecommand import MobileCommand as Command |
| 17 | + |
| 18 | + |
| 19 | +class Sms(webdriver.Remote): |
| 20 | + |
| 21 | + def send_sms(self, phone_number, message): |
| 22 | + """Emulate send SMS event on the connected emulator. |
| 23 | +
|
| 24 | + :Args: |
| 25 | + - phone_number: The phone number of message sender |
| 26 | + - message: message: The message to send |
| 27 | +
|
| 28 | + :Usage: |
| 29 | + self.driver.send_sms('555-123-4567', 'Hey lol') |
| 30 | + """ |
| 31 | + self.execute(Command.SEND_SMS, {'phoneNumber': phone_number, 'message': message}) |
| 32 | + |
| 33 | + def _addCommands(self): |
| 34 | + self.command_executor._commands[Command.SEND_SMS] = \ |
| 35 | + ('POST', '/session/$sessionId/appium/device/send_sms') |
0 commit comments