Appium+Python????????????????
?????bacon?? ???????[ 2017/4/20 14:51:18 ] ????????????????? Python
????3.2.3 ???iOS10????appium??1.6.3???????
????????iOS10??????uiautomator??????XCUITest?????в????appium1.6.0????汾???????uiautomator???????????????????????iOS???????appium1.6.0????汾?????WebDriverAgent????????????iOS????????????????appium1.6.3??????????????????
???????carthage??brew install carthage
???????xcpretty??gem install xcpretty
??????????appium???????£?ж??appium??npm uninstall –g appium.
???????appium1.6.3??npm install –g appium??????????????????????????????????????????????????????????
???????WebDriverAgent??cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent(???????????????в???)
????mkdir –p Resources/WebDriverAgent.bundle
????sh ./Scripts/bootstrap.sh –d??????????????????vpn????????????????ok??????????“star vpn”??????vpn??
????cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent??xcode??WebDriverAgent.xcodeproj??????????Bundle identifier.???Bundle identifier??Facebook?????????????Signing????Automatically manage signing???????????????????????????б????????????bundle identifier????á?????? build??
???????xcode???????cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent??
????xcodebuild –project WebDriverAgent.xcodeproj –scheme WebDriverAgentRunner –destination 'id=?????udid' test.
??????????н???????“Test target WebDriverAgentRunnerencounted an error (Early unexpected exit??operationnever finished bootstrapping –no restart will be attempted)”?????????
???????????????????????????WebDriverAgent??????????????????????????????????????????????????????????(???WedDriverAgent?????????б??????????ù????в???????????)
?????????appium1.6.3????GUI?汾????????????λ???????????macaca???ж?λ??macaca??????????????
????app-inspector??macaca??????λ?????????????????????app-inspector –u "?豸??udid"
????3.3 Linux?氳?
????3.3.1 ????б?
????Linux Ubuntu Destop 14.04????汾
????brew
????ruby
????git
????curl
????node
????jdk
????appium
????Android sdk
????Python Appium??????Appium-Python-Client??Selenium
????3.3.2 ???????
????Appium Server ????
???????ο?https://coderwall.com/p/rcvkrq/install-nodejs-using-homebrew-and-install-appium??
????1. ???nodejs : sudo apt-get remove nodejs????????????nodejs??У?????????????????
????2. ???ruby:sudo apt-get install ruby
???????ruby ????????
????ruby -v??ruby??汾?????
????3. ???git??sudo apt-get install git
????4. ???brew??ruby -e "$(wget -O- https://raw.github.com/Homebrew/linuxbrew/go/install)"
?????????????в????????????????????git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
????5. ???curl??sudo apt-get install curl
????6. ???node.js???????????sudo???????????????????????????????úú???????????????????Σ?
????brew install node
?????????????в??????????????????sudo apt-get install g++??
????sudo apt-get install libssl-dev??
????wget http://nodejs.org/dist/v5.6.0/node-v5.6.0.tar.gz??
????tar zxvf node-v5.6.0.tar.gz??
????./configure(?????仰??е?node??bin???????)??
????make??
????make install??
????sudonpm install –g express-generator@4(????????)??
??????????????????????15?????????????????nodejs????????
????????????
????node -v
????7. ??? Java ?????
????????JDK????????Java SDK
??????????
?????????JDK????????·????/usr/lib/jvm
?????????????????????ε????У???????????????
????1??cd /usr/lib
????2??sudo mkdir jvm
????????????????????????????????????????????????????????????????????????????????????????????????????汾?????????????
????1??sudo tar zxvf ./jdk-7-linux-i586.tar.gz -C /usr/lib/jvm
????2??cd /usr/lib/jvm
????3) sudo mv jdk1.7.0_05/ jdk7
????????JAVA????????
????gedit ~/.bashrc
???????????????β???
????export JAVA_HOME=/usr/lib/jvm/jdk7
????export JRE_HOME=${JAVA_HOME}/jre
????export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
????export PATH=${JAVA_HOME}/bin:$PATH
???????????????????????????????????Ч
????source ~/.bashrc
???????????JDK
?????????ЩLinux????а??????????????JDK????OpenJDK????????????????????????JDK?汾????????JDK?汾????????????????????á?
????????????????
????sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk7/bin/java 300
????sudo update-alternatives --install /usr/bin/javacjavac /usr/lib/jvm/jdk7/bin/javac 300
??????????????????????????????·???????????????????????????????д???OK???
????????????????????????????JDK?汾???????
????sudo update-alternatives --config java
????????
?????????????????????????
????java -version
????????????JDK1.8????
????java version "1.8.0_05"
????Java(TM) SE Runtime Environment (build 1.8.0_05-b05)
????Java HotSpot(TM) Server VM (build 23.1-b03?? mixed mode)
????????java??????????????????
????8. ???appium
?????????appium?????????????1.4.16?汾?????????汾???????????°汾???????npm???????
???????config????
????npm config set registry https://registry.npm.taobao.org (???????????????????????appium???????????????????)
????npm install -g appium@1.4.16
???????????????root?????а????????????
????cd /usr/local/lib
????sudo chown –R ???????? node_modules
???????ж???
????npm uninstall appium –g
????????????????????appium
???????????????????????????????????????????а??????(??????а?????????汾?????????????????????????????)??
??????????????????????????
???????汾
????appium -v
????9. ??????Android SDK Starter Package
????Android SDK Starter Package??????SDK?????????????????????????????????????????????????????????????????????и?android??????????????????????Android SDK and AVD Manager?????????????????????????????????????????????????
?????????????http://developer.android.com/sdk/index.html?????????????????????????????汾????????
??????????????°棬????????android-sdk_r21.1-linux.tgz??
????wget http://dl.gmirror.org/android/android-sdk_r24.4.1-linux.tgz
????????????????????tar zvxf android-sdk_r21.1-linux.tgz
????????????????????3???android-sdk-linux_x86??????????????sdk?????????????????????????????????й??????????ADT????????????????????
?????????????ia32-libs
????sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1
???????? Android SDK
???????? Android ??????????????????????????????????????????????sdk????????????·???????HOME??????????£?
????export ANDROID_HOME="$HOME/adt/sdk"
????export PATH=${PATH}:~/adt/sdk/tools
????export PATH=${PATH}:~/adt/sdk/platform-tools
???????source
????source ~/.bashrc
????10. ???Appium??????ubuntu?????python2.7??python3.4?汾??
???????Appium-Python-Client?????pip?????
????sudo apt-get install python-pip
????sudo pip install Appium-Python-Client
????(????????????????)
??????? selenium 2.0??/usr/local/lib/python2.7/dist-packages????????譎???
????sudo apt-get install selenium
????????Appium
????????appium?????????????
????appium-doctor
???????л??????????????ú?????????????JAVA_HOME??ANDROID_HOME??????????????
??????????????appium
???????? welcome to appium v1.4.16 ?????????
???????????
????????????/python2.7/dist-packages??????2???????
????????????
?????????? ??????
????4.1 ??????Windows??
???????Appium????Appium Inspector???п????????????????????е?????????????Tap??Text???????????????????????£????????????????
????4.2 ??????Mac??
???????Appium????Appium Inspector???п??????????????
????4.3 tips
????Appium???汾???????
????Linux?????????appium -a 127.0.0.1 -p ???? -bp ???? --session-override --no-reset
????Mac?????????appium -a 127.0.0.1 -p ???? -bp ???? --session-override --no-reset --tmp ·??
????Mac????????appium??С??1.6.0??汾?????г?????????????????appium??????????????????????????tmp?????????????????appium(????1.6.0)??????????WebDriverAgent???????и?appium????????wda??pc?????????????????????????setCapability("wdaLocalPort"??"????")????????appium?????wdaLocalPort???????
????Appium????????б????FATAL ERROR:CALL_AND_RETRY_LAST Allocation failed – process out of memory ?????????????????????ж??node????????????node??bug??
?????????? python??????
????driver??????
from appium import webdriver
import time
from selenium.common.exceptions import NoSuchElementException
class driverObject:
def __init__(self?? host?? port?? platform?? version?? deviceName?? noReset?? unicodeK?? resetK?? appPath ??appP_bdId?? appA_udid?? localPort):
#__appP_bdId = "com.yitong.fjnx.mbank.android"
__appP_bdId = appP_bdId
#__appA_udid = ".Splash"
__appA_udid = appA_udid
self.pwmode = 'lower'
self.model='Appium'
self.desired_caps = {}
self.desired_caps['platformName'] = platform
self.desired_caps['platformVersion'] = version
self.desired_caps['noReset'] = noReset
self.desired_caps['unicodeKeyboard'] = unicodeK
self.desired_caps['resetKeyboard'] = resetK
self.desired_caps['app'] = appPath
self.desired_caps['udid'] = deviceName
self.desired_caps['deviceName'] = deviceName # Android - ignored?? iOS - iPhone name
if platform == "Android":
self.desired_caps['appPackage'] = __appP_bdId
self.desired_caps['appActivity'] = __appA_udid
if platform == "iOS":
self.desired_caps['bundleId'] = __appP_bdId
self.desired_caps['automationName'] = 'XCUITest'
self.desired_caps['wdaLocalPort'] = localPort
url = "http://" + host + ":" + str(port) + "/wd/hub"
self.driver = webdriver.Remote(url?? self.desired_caps)
time.sleep(5)
def get_driver(self):
return self.driver
def quit(self):
self.driver.quit()
????????
from testClass import driverObject
if __name__ == '__main__':
driver = driverObject(????...)
ele = self.driver.find_elements_by_class_name("android.widget.Button")
ele[0].click()
time.sleep(5)
ele = self.driver.find_elements_by_class_name("android.widget.EditText")
ele[1].send_keys("account")
ele[2].send_keys("password")
ele = self.driver.find_elements_by_class_name("android.widget.Button")
time.sleep(2)
ele[0].click()
driver.quit()
????????Appium??Python??????????????????????Appium-Python-Api???????????Appium????python???????????????????????????????????????????????????????????????Щ??????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11