Turn from: http://www.jianshu.com/p/bf1ca3d4ac76 write this article mood
Really very happy, I look at the official website introduced unexpectedly to appiumdesktop slightly understand fur. It was written today, hoping to help some of the first-in-the-pit partners. Appiumdesktop really is a good thing:
1, first he can be set as the element information (the element mentioned here refers to the space on the app), which is the same as the Android Uiautomatorviewer, but Appiumdesktop can locate iOS and Android two operating system of the app;
2. There is one more thing he can record scripts. It's really cool. The scripting language can also be chosen by itself, for example, if I choose to use the Python language, then the recorded script is the Python language. But for this point, the web said, this function is only to do the learning tool, not as a code generator (in sum, it is a learning tool, not a robust code generation feature, and should are use D as such.).
Appiumdesktop.png
Is Appiumdesktop Inspactor after the start of the appearance, next we will talk about how to use this mysterious appiumdesktop.
What is Appiumdesktop
Some say appiumdesktop is the appium of the new version, that is, before and after Xcode8. Since XCODE8 's automated test framework was called UIAUTOMATION,XCODE8, it was completely deprecated and started using xcuitest, which led Appium to overhaul its underlying mechanism to use Facebook's Webdriveragen
, that is, when testing iOS apps with Appium, you must first install an app on your iphone called: Webdriveragentrunner. That is, this application is used to launch the application we are testing.
So appiumdesktop is not appium.
The icon for the Appium is this:
Appium.png
The icon for the appiumdesktop is this:
Appium Desktop.png
Appiumdesktop the page after startup is this:
Appiumdesktop start page. png
The page that the Appiumdesktop service started (Appiumdesktop is now 1.6.5 version) is this:
Appiumdesktop Server startup page. png
The Appiumdesktop startup page is like this:
Appium start page. png Start Appium Inspector
When you start Appiumdesktop Click the Start new Session button in the upper right corner of the page, a new session window (such as) will be launched and we need to configure some desired capabilities information in this window:
Desired Capabilities.png
Here is an example of the iphone 7 plus simulator:
PlatformName: Because it's using an iOS phone
platformversion: Consistent with the actual emulator version, my simulator is version 10.3
devicename: I am using iphone 7 Plus, you can also fill out iphone Simulator and will launch a default (iphone 6) simulator
app: The app you want to install is an officially available demo. Of course, you can also install your own app to be tested, but it's not necessarily text (probably filepath)
NoReset: is a bool value, select True.
If you want to use a real machine, you must add another field Udid, is the text type.
The Udid method for getting a connected PC's iphone via the terminal:
Idevice_id-l
After configuring this information, click Save As ... Save and save for later use (if needed), this information is stored in "Saved Capability sets". Then click Start Session can start inspector, this process is slow, need to wait a few minutes. You will then see the window shown in the first diagram of the article.
locating element Information
One of the most important messages for writing Appium scripts is locating elements, getting the ID of an element, or XPath, and so on.
Just click on the Select button in the leftmost column of Inspector, then click on the element you want to get information from, and when the element is highlighted, its information will be displayed in the detailed view on the right side of Inspector. Some are targeted with accessibility ID, some are XPath targeting or other location information, but on iOS apps Appium recommends using accessibility ID to locate an element information.
In the middle of the inspector window is the hierarchy of your application, expressed as XML.
Sliding pages (elements)
Now you can locate the elements of the current page, but how do you swipe to the next page or slide the slider on the page?
Select Swipe. Analog gestures on the phone, from the beginning to the end of each click, the realization of sliding.
Click on an element
What if we want to click on an element for the next step, such as entering text in the input box or popping an alert?
Select Tap. Then click on TextField or alert and we can proceed to the next operation. If you want to locate the element information on alert, switch to select when the alert pops up, then click on the element you want to locate.
Recording scripts
This is really a very useful feature. He seems to have solved one of our big problems, which is the problem of which API to use and the Scripting specification. It is a good reference for the small partners who are initially in the pit. The script recording function is the eye icon, such as:
Script recording. png
Click the button later like:
Script recording. png
Then you can go to the left to manipulate the app, here I do the following: Click the input box, click Alert, Slide the slider, swipe the screen, click on the soft keyboard and enter text (here I choose the Python language). At this time the script generated by inspector is very simple, just record the steps of your operation and cannot execute, this script is as follows:
Touchaction (Driver). Tap ([(167, 73)])
Touchaction (Driver). Tap ([(81, 300)])
Touchaction (Driver). Tap ([(303, 414)])
El1 = driver.find_element_by_accessibility_id ("Integera")
El1.click ()
El1.send_keys ("Hello")
Touchaction (Driver)
. Press ({x:198, y:393})
. MoveTo ({x:50:y: 0})
. Release ()
Touchaction (Driver)
. Press ({x:335, y:264})
. MoveTo ({x: -183:y:-3})
. Release ()
Touchaction (Driver). Tap ([(191, 498)])
Touchaction (Driver). Tap ([(357, 698)])
I didn't read the code anyway. Don't worry, this is just inspector default generated minimalist script, good inspectory provides us with a function that is to make a minimalist script executable script, operations such as:
Script recording. png
Now the script has become this way:
# This sample code uses the Appium Python client
# pip install appium-python-client
# So you can paste this int o A file and simply run with Python
from appium import webdriver
caps = {}
caps["platformname"] = "IOS"
caps[" Platformversion "] =" 10.3 "
caps[" devicename "] =" IPhone 7 Plus "
caps[" App "=" http://appium.s3.amazonaws.com/ Testapp7.1.app.zip "
caps[" noreset "] = True
Driver = webdriver.remote (" Http://0.0.0.0:4723/wd/hub ", caps)
Touchaction (Driver). Tap ([(167)])
Touchaction (Driver). Tap ([(Bayi, +)])
Touchaction (Driver). Tap ([(303, 414)])
El1 = driver.find_element_by_accessibility_id ("Integera")
El1.click ()
El1.send_keys ("Hello")
Touchaction (Driver)
. Press ({x:198, y:393})
. MoveTo ({x:50:y: 0})
. Release ()
Touchaction (driver)
. Press ({x:335, y:264})
. MoveTo ({x: -183:y:-3})
. Release ()
Touchaction (Driver). Tap ([(191, 498)])
Touchaction (Driver). Tap ([(357, 698)])
Driver.quit ()
Is this the same as the script we wrote, you learned it?
In the learning process encountered problems can leave a message, learn from each other, common progress!
Cook cooks.
Links: http://www.jianshu.com/p/bf1ca3d4ac76
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Appiumdesktop Usage Introduction