#2 楼 @xiaomayi0323
swipeScreen(160.0, 300.0, 160.0, 10.0, 1.0, 2, driver);
没有报任何错误,就是不滑动了。之前在 1.2.0 的时候还好好的。
driver.swipe(160, 300, 160, 10, 2);
appium 封装的方法,这样为什么不行呢。
#37 楼 @seveniruby 请问怎样设置参数?
#3 楼 @seveniruby 请问如何做到一个 PC 机对多个终端设备进行测试?代码应该如何改,nodeconfig.json 文件应该怎么配置?
{
"capabilities":
[
{
"platformName":"iOS",
"platformVersion":"7.1.2",
"deviceName":"iPhone4s",
"app":"com.ios.app"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://0.0.0.0:5000/wd/hub",
"host":"0.0.0.0",
"port":5000,
"maxSession":10,
"register":true,
"registerCycle":1000,
"hubPort":4444,
"hubHost":"0.0.0.0"
}
}
如果用 launchApp 的话,就会提示
(Requested a new session but one was in progress) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 120 milliseconds
#1 楼 @lihuazhang
乱码的问题怎么解决?
有人见过这种情况么?求解答?
Error: Could not find a device to launch. You requested 'iPhone simulator (8.0 Simulator)', but the available devices were: ["iPad 2 (7.1 Simulator) [898ABFD9-E5DF-4143-9EBE-80BFD9B89CA4]","iPad 2 (8.0 Simulator) [0A06BC1A-D2CC-4E09-9A2A-22F9DAB4C110]","iPad Air (7.1 Simulator) [21445BCC-CD01-448C-9363-F8D81AC80269]","iPad Air (8.0 Simulator) [3690169F-B23A-4B0C-A9B9-0DD57D0F0932]","iPad Retina (7.1 Simulator) [D9D71C18-02F0-4141-BFEE-9CFEEB5E9419]","iPad Retina (8.0 Simulator) [DEBBE2FB-5B49-40BD-828B-66983D9C48A8]","iPhone 4s (7.1 Simulator) [A08BD66B-A0B4-48DC-B2FE-42B467BC510B]","iPhone 4s (8.0 Simulator) [48268B44-5CDA-4A08-BAD3-FEC48813D14D]","iPhone 5 (7.1 Simulator) [5097D55F-1AA6-4C52-9C5B-072D7736295F]","iPhone 5 (8.0 Simulator) [06C74D69-6B54-4516-A48E-B92A251B37BD]","iPhone 5s (7.1 Simulator) [730C7F7A-E47F-4312-9CA4-90126FDBCB86]","iPhone 5s (8.0 Simulator) [7D21C1D6-0ADD-4249-8362-AD1087DC6F7F]","iPhone 6 (8.0 Simulator) [0579EF54-DBE7-4CE8-A5F0-BE37E7ACDD96]","iPhone 6 Plus (8.0 Simulator) [AEDEA1F4-CB10-4310-A2BF-6D3A4BCEB91D]"]
我升级后,按照你的方法,提示找不到模拟器,但是实际上本机上有可用的模拟器,如上面的代码
如下为错误的提示:
十月 10, 2014 12:23:52 上午 AppDrivers init25ppInstaller
信息: 测试应用正在iOS模拟器中启动...
十月 10, 2014 12:23:54 上午 AppDrivers init25ppInstaller
信息: 测试应用启动失败...A new session could not be created. (Original error: Could not find a device to launch. You requested 'iPhone simulator (8.0 Simulator)', but the available devices were: ["iPad 2 (7.1 Simulator) [898ABFD9-E5DF-4143-9EBE-80BFD9B89CA4]","iPad 2 (8.0 Simulator) [0A06BC1A-D2CC-4E09-9A2A-22F9DAB4C110]","iPad Air (7.1 Simulator) [21445BCC-CD01-448C-9363-F8D81AC80269]","iPad Air (8.0 Simulator) [3690169F-B23A-4B0C-A9B9-0DD57D0F0932]","iPad Retina (7.1 Simulator) [D9D71C18-02F0-4141-BFEE-9CFEEB5E9419]","iPad Retina (8.0 Simulator) [DEBBE2FB-5B49-40BD-828B-66983D9C48A8]","iPhone 4s (7.1 Simulator) [A08BD66B-A0B4-48DC-B2FE-42B467BC510B]","iPhone 4s (8.0 Simulator) [48268B44-5CDA-4A08-BAD3-FEC48813D14D]","iPhone 5 (7.1 Simulator) [5097D55F-1AA6-4C52-9C5B-072D7736295F]","iPhone 5 (8.0 Simulator) [06C74D69-6B54-4516-A48E-B92A251B37BD]","iPhone 5s (7.1 Simulator) [730C7F7A-E47F-4312-9CA4-90126FDBCB86]","iPhone 5s (8.0 Simulator) [7D21C1D6-0ADD-4249-8362-AD1087DC6F7F]","iPhone 6 (8.0 Simulator) [0579EF54-DBE7-4CE8-A5F0-BE37E7ACDD96]","iPhone 6 Plus (8.0 Simulator) [AEDEA1F4-CB10-4310-A2BF-6D3A4BCEB91D]"]) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.05 seconds
Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47'
System info: host: 'ifufeiyangtekiMac.local', ip: '192.168.235.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.8.0'
Driver info: io.appium.java_client.AppiumDriver
十月 10, 2014 12:23:59 上午 IndexTest AlertClose
信息: 关闭提示框出现异常null
#7 楼 @seveniruby 那怎么设置才不至于报错呢?
#1 楼 @lihuazhang 我找出来的的目的有点不一致哦。
#10 楼 @lihuazhang 那 ios 的断开网络连接就没其它的办法通过代码来实现了么?
#8 楼 @lihuazhang 运行在苹果真机或者 ios 模拟器上没问题,但是起不到关闭网络连接的作用。
#3 楼 @lihuazhang java client 版本是:1.6.2
运行提示报错,说是没有 setNetworkConnection 这个方法,但是我看到 AppiumDriver 中有这个方法啊。
org.openqa.selenium.WebDriverException: ERROR running Appium command: Object [object Object] has no method 'setNetworkConnection'
Command duration or timeout: 8 milliseconds
Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47'
System info: host: 'ifufeiyangtekiMac.local', ip: '192.168.235.131', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.8.0'
Driver info: io.appium.java_client.AppiumDriver
Capabilities [{app=net.os.iosapp, networkConnectionEnabled=false, warnings={}, databaseEnabled=false, deviceName=iPhone, platform=MAC, desired={app=net.os.iosapp, appium-version=1.0, platformVersion=7.1, platformName=iOS, deviceName=iPhone}, appium-version=1.0, platformVersion=7.1, webStorageEnabled=false, locationContextEnabled=false, browserName=iOS, takesScreenshot=true, javascriptEnabled=true, platformName=iOS}]
Session ID: d77c5c8b-e941-479a-983a-53cac363281a
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:95)
at io.appium.java_client.AppiumDriver.setNetworkConnection(AppiumDriver.java:558)
at com.teiron.app.oschina.TestRealDevice.testHello(TestRealDevice.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at com.teiron.app.oschina.TestRealDevice.tearDown(TestRealDevice.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
试了好多次,上面的办法无法断开 wifi,模拟器以及真机上都无断开 wifi,
下面为我的调用方法
networkConnectionTest(false,false,true, driver);
#3 楼 @xiaomayi0323 不支持 7.0 以上的,比如那个锁屏,断开网络连接等,我试过了。锁屏是能锁屏,但是又无法解锁