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.