• #3 楼 @luis 我很菜啊,不知道怎么换呢?你能给我解答一下么?

  • #1 楼 @luis 可以进行上拉下拉滚动条滑块操作,但是无法进行下拉即可刷新操作

    String js_snippet = "mobile: scroll";
    JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap<String, String> scrollObject = new HashMap<String, String>();
    scrollObject.put("direction","down");
    js.executeScript(js_snippet,scrollObject);
    
  • #3 楼 @lihuazhang

    org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: spawn ENOENT) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 794 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
        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 org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
        at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:49)
        at com.teiron.app.Password.TestRealiPhone.setUp(TestRealiPhone.java:36)
        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.RunBefores.evaluate(RunBefores.java:24)
        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.NullPointerException
        at com.teiron.app.Password.TestRealiPhone.tearDown(TestRealiPhone.java:42)
        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)
    
    
    

    它提示这个报错。

  • #1 楼 @monkey 好的,以后知道了,你帮我看一下

  • #6 楼 @xiaomayi0323
    报错代码:
    info: [debug] App is an iOS bundle, will attempt to run as pre-existing
    info: [debug] Creating new appium session 6b59eb9a-213c-43c2-9ce9-94fab6eb71e1
    info: [debug] Removing any remaining instruments sockets
    info: [debug] Cleaned up instruments socket /tmp/instruments_sock
    info: [debug] Setting Xcode folder
    info: [debug] Setting Xcode version
    info: [debug] Setting iOS SDK Version
    info: [debug] iOS SDK Version set to 7.1
    info: [debug] Detecting automation tracetemplate
    info: [debug] Not auto-detecting udid, running on sim
    info: [debug] Localizable.strings is not currently supported when using real devices.
    info: [debug] Not setting locale because we're using a real device
    info: [debug] Creating instruments
    info: [debug] Preparing uiauto bootstrap
    info: [debug] Dynamic bootstrap dir:
    info: [debug] Dynamic env:
    info: [debug] Dynamic bootstrap code:
    info: [debug] Dynamic bootstrap path:
    info: [debug] Reusing dynamic bootstrap:
    info: [debug] Not setting iOS and app preferences since we're on a real device
    info: [debug] Starting iOS device log capture via deviceconsole
    error: iOS log capture failed: spawn ENOENT
    info: [debug] Cleaning up appium session
    error: Failed to start an Appium session, err was: Error: spawn ENOENT
    info: [debug] Error: spawn ENOENT
    at errnoException (child_process.js:1000:11)
    at Process.ChildProcess._handle.onexit (child_process.js:791:34)
    info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn","origValue":"spawn ENOENT"},"sessionId":null}
    info: <-- POST /wd/hub/session 500 177.110 ms - 197
    info: [debug] Not setting device type since we're connected to a device
    info: [debug] Creating iDevice object with udid a0ee9c874742cd***ef1b43f148fe72068c58265
    info: [debug] Couldn't find ideviceinstaller, trying built-in at /usr/local/lib/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
    info: [debug] Checking app install status using: /usr/local/lib/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id a0ee9c874742cd***ef1b43f148fe72068c58265 --bundle kingdee.Password

    Java Eclipse 中报错的代码:
    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
    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 org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:49)
    at com.teiron.app.Password.TestRealiPhone.setUp(TestRealiPhone.java:38)
    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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:653)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

    程序部分代码:

    public void testUIComputation() throws Exception {  
        //触发生成密码按钮
        WebElement button = driver.findElement(By.name("button_pwd"));
        button.click();
        //断言生成的值是否跟输入的值相等
        WebElement texts = driver.findElement(By.name("Text_pwd"));
        assertEquals("判断值是否相等:",String.valueOf(texts.getText().length()), String.valueOf(values.get(0)));     
    }```
    
  • #4 楼 @xiaomayi0323 在模拟器上,运行 java 类中添加的测试方法能够运行,为什么当连接到真机的时候,运行不了了呢?

  • 请问如何连接苹果手机真机呢?
    我的应用程序代码已经在真机上运行过,然后我想通过 appium 来运行应用到真机中?

  • #3 楼 @seveniruby 你说的方法我都试过,mac 系统下的目录,我自己都可以手动删除,也没什么进程占用,另外,该目录是一定有的。关键是这个 jenkins 之前没用过,网上的资料也少。

  • #1 楼 @seveniruby 这也是移动相关的啊,我这个项目是苹果移动手机的测试,需要部署到 jenkins 中进行自动构建运行。

  • 问题已解决,原因是下的 maven 有问题。
    要下载 bin 版本的才行

  • 这个问题有人碰到过没有啊,好奇怪的呢。请大神解答。

  • #22 楼 @monkey 那个问题我多写了一个 s,问题解决了,python 是第一次用,以前只是用 java,C++ 和 OC,不过这种方法用 class 的话,只能对界面中的一个 statictext 取值,如果界面中有多个 statictext 呢?

  • #18 楼 @lihuazhang 那你把代码贴出来不就行了吗?你的代码中有 text 属性,到我这,它提示说没有这个属性。

  • #16 楼 @andward 我就是填写 Maven 时才出现这种问题。我在我家电脑填了没问题,我在我公司电脑填了就有问题,不知道是什么引起来的。我是手工安装的,不需要自动安装。

  • #16 楼 @lihuazhang 这不是我基本语法会不会的问题啊,我试过好多种方式都取不出来。关键是你给的方法也不行啊。

  • #14 楼 @lihuazhang 报错如下:
    Traceback (most recent call last):
    File "simple.py", line 48, in test_ui_computation
    sum = self.driver.find_elements_by_class_name('UIAStaticText').text
    AttributeError: 'list' object has no attribute 'text'

  • #8 楼 @lihuazhang

    File "simple.py", line 58
    WebElement tests = driver.findElement(By.className("UIAStaticText"));
    ^
    IndentationError: unexpected indent
    还是报错呢。。

  • #11 楼 @seveniruby 不明白。。。
    #1 楼 @lihuazhang 你能看看么?

  • #9 楼 @link1220 type 类型为 UIAStaticText,不一样,我的这个是要求取出 5 这个值,但是属性中没有显示这个值

  • 有谁知道啊,这个问题怎么解决呢,花了好多时间,取出来的值是 sums,而不是 5

  • #8 楼 @seveniruby 我不知道去区分 master 和 slave, 我不明白这两个是什么目录

  • #6 楼 @seveniruby 什么机器搞错了?