Om *_*ash 14 java geolocation ios appium
Meta: -
其实我想设置GeoLocation在iOS使用设备Appium XCUITest的自动化.我尝试使用下面的代码,它在Android设备上工作正常,同时抛出异常iOS:
import org.openqa.selenium.html5.Location;
AppiumServiceBuilder builder = new AppiumServiceBuilder().usingAnyFreePort().withAppiumJS("path/to/appium/main.js");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("automationName", "XCUITest");
IOSDriver driver= new IOSDriver(builder, capabilities);
//Here this code working fine with AndroidDriver
Location location = new Location(latitude, longitude, altitude);
driver.setLocation(location);
Run Code Online (Sandbox Code Playgroud)
例外:
org.openqa.selenium.WebDriverException:方法尚未实现(警告:服务器未提供任何堆栈跟踪信息)
当我尝试使用JavascriptExecutor时:
Map<String, String> args = new HashMap<String, String>();
args.put("address", "Address");
((JavascriptExecutor)webDriver).executeScript("mobile:setLocation", args);
Run Code Online (Sandbox Code Playgroud)
例外:
org.openqa.selenium.UnsupportedCommandException:未知的移动命令"setLocation".只有滚动,滑动,捏合,双击,两个手指点击,触摸和保持,点击,拖动来自动态,selectPickerWheelValue,才支持警报命令.(警告:服务器未提供任何堆栈跟踪信息)
当我尝试:
import org.openqa.selenium.remote.DriverCommand;
Map<String, String> args = new HashMap<String, String>();
args.put("location", "Address");
driver.execute(DriverCommand.SET_LOCATION, args);
Run Code Online (Sandbox Code Playgroud)
例外:
org.openqa.selenium.WebDriverException:方法尚未实现(警告:服务器未提供任何堆栈跟踪信息)
反正有没有GeoLocation开始iOS使用appium?
Appium日志:
[debug] [JSONWP Proxy]获得状态为200的响应:"{\n \"value \":{\n \"state \":\"success \",\n \"os \":{\n\"name \":\"iOS \",\n \"version \":\"10.3.1 \"\n},\n \"ios \":{\n \"simulatorVersion \":\"10.3 .1 \",\n \"ip \":\"192.168.1.17 \"\n},\n \"build \":{\n \"time \":\"2017年8月29日15:40: 09 \"\n} \n},\n \"sessionId \":\"10A97A93-D13A-4888-A536-0D62E0674A2B \",\n \"状态\":0 \n}"
[debug] [XCUITest] WebDriverAgent在ip上运行'192.168.1.17'[调试] [XCUITest] WebDriverAgent在16121ms后成功启动[debug] [BaseDriver]事件'wdaSessionAttempted'记录在1504013035278(格林尼治标准时间18:53:55 + 0530(IST) ))[debug] [XCUITest]将createSession命令发送到WDA [debug] [JSONWP Proxy]将[POST/session]代理到[POST http:// localhost:8100/session] with body:{"desiredCapabilities":{"bundleId ":" com.example.apple-samplecode.UICatalog", "参数":[], "环境":{}, "shouldWaitForQuiescence":真"shouldUseTestManagerForVisibilityDetection":假"maxTypingFrequency":120, "shouldUseSingletonTestManager": true}} [debug] [JSONWP Proxy]获得状态为200的响应:{"value":{"sessionId":"43710C7E-2FDE-4A35-A2E0-4D309EE2CE9C","capabilities":{"device":"iphone" "browserName": "UICatalog", "sdkVersion": "10.3.1", "CFBundleIdentifier": "com.example.apple-samplecode.UICatalog"}}, "的sessionId":"43710C7E-2FDE-4A35-A2E0- 4D309EE2CE9C","status":0} [debug] [BaseDriver]事件'wdaSessio nStarted'loged at 1504013038184(18:53:58 GMT + 0530(IST))[debug] [XCUITest]找到WDA派生数据文件夹:'/ User/Comprakash.mishra/Library/Developer/Xcode/DelivedData/WebDriverAgent-digkwtrisltbeobjmfvpthwwekvs' [XCUITest]将"555"权限设置为'/Users/omprakash.mishra/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/Attachments'文件夹[debug] [XCUITest]找到WDA派生数据文件夹:'/ Users/omprakash.mishra/Library/Developer/Xcode/DerivedData/WebDriverAgent-folfazwwukpzfkegdblpnfuwlvfn'[XCUITest]将'555'权限设置为'/Users/omprakash.mishra/Library/Developer/Xcode/DerivedData/WebDriverAgent-folfazwwukpzfkegdblpnfuwlvfn/Logs/Test/Attachments'文件夹[debug] [BaseDriver]事件'wdaPermsAdjusted'记录于1504013038192(格林威治标准时间18:53:58(IST))[调试] [BaseDriver]事件'wdaStarted'记录于1504013038193(格林威治标准时间18:53:58) +0530(IST))[debug] [XCUITest]将初始方向设置为'PORTRAIT'[debug] [JSONWP Proxy]代理 [POST/orientation]到[POST http:// localhost:8100/session/43710C7E-2FDE-4A35-A2E0-4D309EE2CE9C/orientation] with body:{"orientation":"PORTRAIT"} [debug] [JSONWP Proxy] Got状态为200的响应:{"value":{},"sessionId":"43710C7E-2FDE-4A35-A2E0-4D309EE2CE9C","status":0} [debug] [BaseDriver]事件'orientationSet'记录于1504013038453(18 :格林威治标准时间53:58(IST))[Appium]新的XCUITestDriver会话成功创建,会话6909c363-12a5-4a21-9298-c7f750ba7e09添加到主会话列表[debug] [BaseDriver]事件'newSessionStarted'记录于1504013038456(18 :53:58 GMT + 0530(IST))[debug] [MJSONWP]使用driver.createSession()结果响应客户端:{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform ":" MAC " "javascriptEnabled":真"databaseEnabled":假"takesScreenshot":真"networkConnectionEnabled":假, "应用程序": "SRC /测试/资源/执行/ UICatalog.app"," maxTypingFrequency ":" 120" , "newCommandTimeout":0 "platformVersion": "10.3","自动 mationName":"XCUITest","platformName":"iOS","udid":"0A41ECE4-6D03-4FEA-A82A-858FDBA6620E","deviceName":"iPhone 6"} [HTTP] < - POST/wd/hub/session 200 46915 ms - 512 [HTTP] - > GET/wd/hub/session/6909c363-12a5-4a21-9298-c7f750ba7e09 {} [debug] [MJSONWP]用args调用AppiumDriver.getSession():[" 6909c363-12a5-4a21-9298-c7f750ba7e09"] [debug] [XCUITest]执行命令'getSession'[debug] [JSONWP Proxy]将[GET /]代理为[GET http:// localhost:8100/session/43710C7E-2FDE 没有主体[ -4A35-A2E0-4D309EE2CE9C] [调试] [JSONWP代理]获得状态200的响应:"{\n \"值\":{\n \"sessionId \":\"43710C7E-2FDE-4A35- A2E0-4D309EE2CE9C \",\n \"capabilities \":{\n \"device \":\"iphone \",\n \"browserName \":\"UICatalog \",\n
\"sdkVersion \" :\"10.3.1 \",\n \"CFBundleIdentifier \":\"com.example.apple-samplecode.UICatalog \"\n} \n},\n \"sessionId \":\"43710C7E-2FDE -4A35-A2E0-4D309EE2CE9C \",\n \"状态\":0 \n}"[XCUITest]合并针对会话详细信息响应的Appium上限的WDA上限 [debug] [MJSONWP]使用driver.getSession()结果响应客户端:{"udid":"","app":"src/test/resources/executor/UICatalog.app","maxTypingFrequency":120," newCommandTimeout":0,"platformVersion":"10.3","automationName":"XCUITest","platformName":"iOS","deviceName":"iPhone 6","device":"iphone","browserName": "UICatalog","sdkVersion":"10.3.1","CFBundleIdentifier":"com.example.apple-samplecode.UICatalog"} [HTTP] < - GET/wd/hub/session/6909c363-12a5-4a21- 9298-c7f750ba7e09 200 110 ms - 406 [HTTP] - > GET/wd/hub/session/6909c363-12a5-4a21-9298-c7f750ba7e09 {} [debug] [MJSONWP]用args调用AppiumDriver.getSession():[" 6909c363-12a5-4a21-9298-c7f750ba7e09"] [debug] [XCUITest]执行命令'getSession'[debug] [JSONWP Proxy]将[GET /]代理为[GET http:// localhost:8100/session/43710C7E-2FDE 没有主体[ -4A35-A2E0-4D309EE2CE9C] [调试] [JSONWP代理]获得状态200的响应:"{\n \"值\":{\n \"sessionId \":\"43710C7E-2FDE-4A35- A2E0-4D309EE2CE9C \",\n \"能力\":{\n \"device \":\"iphone \",\n \"browserName \":\"UICatalog \",\n
\"sdkVersion \":\"10.3.1 \",\n \"CFBundleIdentifier \":\"com.example.apple-samplecode.UICatalog \"\n} \n},\n \"sessionId \":\"43710C7E-2FDE-4A35-A2E0-4D309EE2CE9C \",\n \"状态\":0 \n}"[XCUITest]合并针对会话详细信息响应的Appium上限的WDA上限[debug] [MJSONWP]使用driver.getSession()结果响应客户端:{"udid":"","app": "SRC /测试/资源/执行/ UICatalog.app", "maxTypingFrequency":120, "newCommandTimeout":0 "platformVersion": "10.3", "automationName": "XCUITest", "platformName": "的iOS", "deviceName":"iPhone 6","device":"iphone","browserName":"UICatalog","sdkVersion":"10.3.1","CFBundleIdentifier":"com.example.apple-samplecode.UICatalog" } [HTTP] < - GET/wd/hub/session/6909c363-12a5-4a21-9298-c7f750ba7e09 200 103 ms - 406 [HTTP] - > POST/wd/hub/session/6909c363-12a5-4a21-9298 -c7f750ba7e09/location {"location":{"altitude":0,"latitude":20.672267,"hCode":1751403001,"class":"org.openqa.selenium.html5.L ocation","经度":83.1649}} [debug] [MJSONWP]用args调用AppiumDriver.setGeoLocation():[{"altitude":0,"latitude":20.672267,"hCode":1751403001,"class":" org.openqa.selenium.html5 .Location","longitude":83.1649},"6909c363-12a5-4a21-9298-c7f750ba7e09"] [debug] [XCUITest]执行命令'setGeoLocation'[HTTP] < - POST/wd/hub/session/6909c363-12a5-4a21-9298-c7f750ba7e09/location 501 30 ms - 122 org.openqa.selenium.WebDriverException:方法尚未实现(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:58毫秒构建信息:版本:'3.4.0',修订版:'未知',时间:'未知'系统信息:主机:'Abhays-MacBook-Air.local',ip:'fe80:0:0: 0:4fc:aa3c:d673:369e%en0',os.name:'Mac OS X',os.arch:'x86_64',os.version:'10 .12.5',java.version:'1.8.0_131'驱动程序信息:io.appium.java_client.ios.IOSDriver功能[{app = src/test/resources/executor/UICatalog.app,networkConnectionEnabled = false,databaseEnabled = fals e,deviceName = iPhone 6,platform = MAC,maxTypingFrequency = 120,newCommandTimeout = 0,platformVersion = 10.3,webStorageEnabled = false,locationContextEnabled = false,automationName = XCUITest,browserName =,takesScreenshot = true,javascriptEnabled = true,platformName = iOS, UDID = 0A41ECE4-6D03-4FEA-A82A-858FDBA6620E}]会话ID:6909c363-12a5-4a21-9298-c7f750ba7e09在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java: 62)在org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java)的java.lang.reflect.Constructor.newInstance(Constructor.java:423)中的sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) :215)atg.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)atg.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)at io.appium.java_client.DefaultGenericMobileDriver.前 eo(DefaultGenericMobileDriver.java:42)位于io.appium.java_client.AppiumDriver.exe执行(AppiumDriver.java:1)io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)io.appium.java_client位于io.appium.java_client.AppiumDriver.setLocation(AppiumDriver.java:400)的org.openqa.selenium.remote.html5.RemoteLocationContext.setLocation(RemoteLocationContext.java:50)上的.AppiumExecutionMethod.execute(AppiumExecutionMethod.java:46)at org.openqa.selenium.html5.LocationContext $ setLocation.call(未知来源)org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)org.codehaus.groovy.runtime.callsite.AbstractCallSite .call(AbstractCallSite.java:110)org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122)at executor.com.bqurious.keyword.mobile.ios.BqIosSetLocationTest.setLocation(BqIosSetLocationTest.groovy) :72)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Na)tiveMethodAccessorImpl.java:62)在org.junit.runners.model.FrameworkMethod $ 1的java.lang.reflect.Method.invoke(Method.java:498)的sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43). org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)上的orRe.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)中的runReflectiveCall(FrameworkMethod.java:50)位于org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java)的org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)的.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) :78)org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:290)at org.junit.runners.ParentRunner $ 1.schedule( ParentRunner.java:71)org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)org.junit.runners.ParentRunner.access $ 000(Pa)rentRunner.java:58)org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:268)atg.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)org.junit. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run上的org.junit.runners.ParentRunner.run(ParentRunner.java:363)中的internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 459)org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)at org .eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)[HTTP] - > DELETE/wd/hub/session/6909c363-12a5-4a21-9298-c7f750ba7e09 {} [debug] [ MJSONWP]用args调用AppiumDriver.deleteSession():["6909c 363-12a5-4a21-9298-c7f750ba7e09"] [debug] [BaseDriver]事件'quitSessionRequested'记录在1504013038955(格林威治标准时间18:53:58 + 0530(IST))[调试] [JSONWP代理]代理[DELETE/session/6909c363-12a5-4a21-9298-c7f750ba7e09]到[删除 http:// localhost:8100/session/43710C7E-2FDE-4A35-A2E0-4D309EE2CE9C] 没有主体[debug] [JSONWP代理]得到状态为200的响应:" {\n \"value \":{\n \n},\n \"sessionId \":\"28E97E0B-DF47-4325-8991-A28B77134EDB \",\n \"状态\":0 \n} "[XCUITest]关闭子进程[XCUITest]关闭xcodebuild进程(pid 37304)[XCUITest] xcodebuild退出,代码为'null',信号'SIGTERM'[debug] [XCUITest]找到WDA派生数据文件夹:'/ Users /omprakash.mishra/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs'[XCUITest]将'755'权限设置为'/Users/omprakash.mishra/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/附件'文件夹[debug] [XCUITest]找到WDA派生 ed data folder:'/ Users/Comprakash.mishra/Library/Developer/Xcode/DerivedData/WebDriverAgent-folfazwwukpzfkegdblpnfuwlvfn'[XCUITest]将'755'权限设置为'/Users/omprakash.mishra/Library/Developer/Xcode/DerivedData/WebDriverAgent -folfazwwukpzfkegdblpnfuwlvfn/Logs/Test/Attachments'文件夹[debug] [XCUITest]不清除日志文件.使用clearSystemFiles功能打开.[debug] [iOSLog]停止iOS日志捕获[Appium]从我们的主会话列表中删除会话6909c363-12a5-4a21-9298-c7f750ba7e09 [调试] [BaseDriver]事件'quitSessionFinished'记录在1504013039408(格林威治标准时间18:53:59) 0530(IST))[debug] [MJSONWP]收到响应:null [debug] [MJSONWP]但是删除会话,所以不返回[debug] [MJSONWP]用driver.deleteSession()结果响应客户端结果:null [HTTP] < - DELETE/wd/hub/session/6909c363-12a5-4a21-9298-c7f750ba7e09 200 461 ms - 76