1th step, learn about Appium service keywords
Document Address: HTTPS://GITHUB.COM/APPIUM/APPIUM/BLOB/MASTER/DOCS/CN/WRITING-RUNNING-APPIUM/CAPS.CN.MD
2nd step, install the appropriate module in Python
1, Appium-python-client
2, Selenium
3rd step, write the script
#-*-Coding:utf-8-*-
From time import sleep
From Selenium import Webdriver
desired_caps={}
desired_caps[' automationname ']= ' xcuitest ' #Xcode8. Above 2 no uiautomation, need to use Xcuitest
desired_caps[' platformname ']= ' IOS '
desired_caps[' platformversion ']= ' 10.2.1 '
desired_caps['devicename']=' iPhone 5 '
desired_caps[' app ']= ' Xxx.app '
desired_caps[' udid ' = ' device Udid '
desired_caps[' Webdriveragenturl ']= ' http://10.1.18.172:8100/' #url为XCTRunner启动后, gives the serverurlhere-> Http://10.1.18.172:8100<-ServerURLHere
Dr = Webdriver. Remote (' Http://127.0.0.1:4723/wd/hub ', desired_caps)
Sleep (5)
Dr.quit ()
4th step, run the script
1. Start W Ebdriveragentrunner in terminal:xcodebuild-project/usr/local/lib/node_modules/appium/node_modules/ Appium-xcuitest-driver/webdriveragent/webdriveragent.xcodeproj-scheme webdriveragentrunner-destination id= Equipment Udid Test
The following content is successful
Test Suite ' All tests ' started at 2017-02-13 14:31:59.322
Test Suite ' Webdriveragentrunner.xctest ' started at 2017-02-13 14:31:59.329
Test Suite ' uitestinguitests ' started at 2017-02-13 14:31:59.333
Test case '-[uitestinguitests Testrunner] ' started.
t = 0.01s Start Test at 2017-02-13 14:31:59.342
t = 0.01s Set up
2. Start appium:appium-a 127.0.0.1-p 4723 in terminal
The following content is the success
[Appium] Welcome to Appium V1.6.4-beta (rev. 70b1c6de0b889aabc86b1990c59994e6acb8d726)
[Appium] non-default Server args:
[Appium] address: ' 127.0.0.1 '
[Appium] Appium REST HTTP interface listener started on 127.0.0.1:4723
3. Run the Python script
Precautions:
Because the Webdriveragentrunner app can only be installed above iOS9, it is necessary to use the IOS9 device to do the real machine test
Appium1.6.4-beta iOS Real-computer Python script [1]