appium在真机上运行IOS实例要注意的几点包括python和java运行log 和部分关键代码.docx
《appium在真机上运行IOS实例要注意的几点包括python和java运行log 和部分关键代码.docx》由会员分享,可在线阅读,更多相关《appium在真机上运行IOS实例要注意的几点包括python和java运行log 和部分关键代码.docx(11页珍藏版)》请在冰豆网上搜索。
appium在真机上运行IOS实例要注意的几点包括python和java运行log和部分关键代码
appium在真机上运行IOS实例要注意的几点:
包括python和java运行log和部分关键代码
最近在研究appium对于IOS的自动化测试,发现在真机上运行appium提供的开源的例子遇到了几个block,询问了一个这个方便面的高手并且总结网上搜到的帖子,现在综合一下。
appium在模拟器中跑,只需要注意:
1:
app=path找到编译后app所在的位置,如:
注意Release-iphonesimulator这个是模拟器编译后的文件夹
finalFileappDir=newFile(System.getProperty("user.dir"),
"../../../apps/TestApp/build/Release-iphonesimulator");
finalFileapp=newFile(appDir,"TestApp.app");
capabilities.setCapability("app",app.getAbsolutePath());appium真机上运行:
1:
运行的时候要将APP安装到真机上面
2:
运行的时候,不能再开instrument
3:
命令行里面启动的时候,参数写错了应该是appium-U3d2cad7288a64a5445aa98a2cc220132f2cddd1c--appio.appium然后代码里面app=bundleID,如以下例子中:
capabilities.setCapability("app","io.appium.TestApp");而不是那个很长的路径,其中-U参数后面是真机的uuid,可以打开xcode,在windows下的organise下找到,一般mac连接上ipad后会有绿色圆点现在贴上真机上运行Python实例:
Kingsons-MacBook:
Studykingson$appium-U1a601f5cd791bc379115095fc81cd69b096582a3--appcom.telenavsoftware.doudouy
info:
WelcometoAppiumv0.11.4(REVb04decd191002628c88e9bf475553da1cd04a036)
info:
AppiumRESThttpinterfacelistenerstartedon0.0.0.0:
4723
info-socket.iostarted
debug:
Appiumrequestinitiatedat/wd/hub/session
debug:
Requestreceivedwithparams:
{"sessionId":
null,"desiredCapabilities":
{"device":
"iPhoneSimulator","platform":
"Mac","browserName":
"iOS","version":
"7.0","app":
"com.telenavsoftware.doudouy"}}
info:
AppisaniOSbundle,willattempttorunaspre-existing
info:
Creatingnewappiumsessiona36fdf63-9b22-48a4-bb01-4b44ddb54aff
info:
Removinganyremaininginstrumentssockets
info:
Cleanedupinstrumentssocket/tmp/instruments_sock
info:
Cleaningupanytracedirs
info:
Notracedirstocleanup
info:
Localizable.stringsisnotcurrentlysupportedwhenusingrealdevices.
info:
Notsettingdevicetypesincewe'reconnectedtoadevice
info:
StartingiOSdevicelogcaptureviaidevicesyslog
debug:
Realdevicespecifiedbutnoipa,assumingbundleIDisondevice
debug:
Creatinginstruments
info:
instrumentsis:
/Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info:
[INSTSERVER]Instrumentssocketserverstartedat/tmp/instruments_sock
info:
AttemptingtorunapponrealdevicewithUDID1a601f5cd791bc379115095fc81cd69b096582a3
info:
Spawninginstrumentswithcommand:
/Applications/Xcode.app/Contents/Developer/usr/bin/instruments-t/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate-w1a601f5cd791bc379115095fc81cd69b096582a3com.telenavsoftware.doudouy-eUIASCRIPT/usr/local/lib/node_modules/appium/lib/devices/ios/uiauto/bootstrap.js-eUIARESULTSPATH/tmp/appium-instruments/
info:
Andextrawithout-delayenv:
{}
info:
Andlaunchtimeout:
90000ms
info:
[INSTSTDERR]2013-12-1010:
40:
22.536instruments[53424:
507]Connectiontotheremotedevicelostwhilelaunchingtarget.Aborting...
info:
[INSTSTDERR]2013-12-1010:
40:
22.539instruments[53424:
507]Recordingcancelled:
Atleastonetargetfailedtolaunch;abortingrun
info:
[INSTSTDERR]InstrumentsTraceError:
ErrorDomain=com.apple.instrumentsCode=1"ErrorStartingRecording"UserInfo=0x7ff6d308f220{NSLocalizedDescription=ErrorStartingRecording,NSLocalizedRecoverySuggestion=Atleastonetargetfailedtolaunch;abortingrun}
InstrumentsTraceError:
Failedtostarttrace.
info:
[INSTSERVER]Instrumentsexitedwithcode253
error:
Instrumentsdidnotlaunchsuccessfully,failingsession
info:
Cleaningupappiumsession
error:
FailedtostartanAppiumsession,errwas:
Error:
Instrumentsdidnotlaunchsuccessfully--pleasecheckyourapppathsorbundleIDsandtryagain
info:
Respondingtoclientwitherror:
{"status":
33,"value":
{"message":
"Anewsessioncouldnotbecreated.(Originalerror:
Instrumentsdidnotlaunchsuccessfully--pleasecheckyourapppathsorbundleIDsandtryagain)","origValue":
"Instrumentsdidnotlaunchsuccessfully--pleasecheckyourapppathsorbundleIDsandtryagain"},"sessionId":
null}
POST/wd/hub/session5006015ms-342b```
我的部分代码片段:
```python
classTestSequenceFunctions(unittest.TestCase):
defsetUp(self):
#setupappium
app="com.telenavsoftware.doudouy"
#app=os.path.join(os.path.dirname(__file__),
#'../../apps/DDY/build/',
#'DouDouY.app')
#app=os.path.abspath(app)
self.driver=webdriver.Remote(
command_executor='http:
//127.0.0.1:
4723/wd/hub',
desired_capabilities={
'browserName':
'iOS',
'device':
'iPhoneSimulator',
'platform':
'Mac',
'version':
'7.0',
'app':
app
})```
1.启动Appium时,保证你的Real
Device的UDID和你的应用的BundleID正确
2.确保你的应用可以安装到你的真机上
3.安装后请断开与Xcode的连接
4.确保Mac上没有启动Instruments工具以下是JAVA真机运行log:
devexus-iMac:
builddevexu$
appium-U3d2cad7288a64a5445aa98a2cc220132f2cddd1c--appio.appium
info:
WelcometoAppiumv1.1.0(REVe433bbc31511f199287db7724e1ce692bcb32117)
info:
AppiumRESThttpinterfacelistenerstartedon0.0.0.0:
4723
info:
socket.io