Use appium to send text messages, and appium to send text messages.

Source: Internet
Author: User
Tags appium

Use appium to send text messages, and appium to send text messages.

A simple and rough piece of code. The main function is to simulate the function of sending text messages.

Python version 3.5.2

Appium version 1.4.16.1

From appium import webdriver

Desired_caps = {
'Platformname': 'android ',
'Platformversion': '4. 4.2 ',
'Devicename': 'test ',
'Apppackage': 'com. android. Ms ',
'Appactivity': 'com. android. mms. ui. conversationlist ',
}

Driver = webdriver. Remote ('HTTP: // localhost: 4723/wd/hub ', desired_caps)
Driver. find_element_by_accessibility_id ("New message"). click ()
El = driver. find_element_by_name ("")
El. send_keys ("1351030 ")
El1 = driver. find_element_by_name ("Type message ")
El1.send _ keys ("0 ")
Driver. find_element_by_accessibility_id ("Send"). click ()
El1.send _ keys ("HAHAHA ")
Driver. find_element_by_accessibility_id ("Send"). click ()
Driver. quit ()
Interpret the above Code:
1. Import webdriver
2. Confirm the device and installation package for testing.
3. Determine the listening device and Port
4. Locate the new information control and perform a simulated click operation.
5. Locate the input column of the sending number.
6. Simulate input 0 (here we can directly enter a string)
7. Go to the sending control and simulate sending by clicking the user.
8. Input "HAHAHA" on the simulated keyboard"
9. send information
10. Close the application


This is just a small exercise I wrote. We can see that send_keys can be used to simulate keyboard input, but only numbers, letters, symbols and other strings can be entered, but Chinese characters cannot be entered. How do I enter Chinese characters? Let's take a look. Next time, I will describe how to input Chinese characters.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.