• #25 楼 @cy_suncheng 谢谢,这个我明白。。那个问题我已经解决了。

  • #23 楼 @lihuazhang ios 版的找不到下载地址

  • #20 楼 @lihuazhang 这个是网上的例子,我是用来学习的。

  • #17 楼 @lihuazhang 那如何利用这个类进行自动启用模拟器呢?

  • #17 楼 @lihuazhang 好的,明白。。

  • #15 楼 @lihuazhang 再请教一下,这个类是用来干嘛的呢?这个可以用来自动启动模拟器么。

  • #13 楼 @cy_suncheng
    运行 xml 文件中方法是这个类,而这个类中不具有启动模拟器的功能

    具有启动模拟器的功能,应该是启动这个类,而这个类不具有运行功能,该如何处理。

  • #11 楼 @cy_suncheng 现在可以了,不过运行后,为什么不启动模拟器啊,看日志,提示已经执行成功了。

    下面为其中的一个方法

    @Test
    public void testLogin() {
        System.out.println("Executing Login Scenario");
        methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        try {
            impScreen.login(methodName);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    

    下面为运行日志

    [TestRunner] Running the tests in 'iPhoneHybEshopTest' with parallel mode:tests
    [RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@1c53fd30 priority: 10
    [TestClass] Creating TestClass for [ClassImpl class=com.photon.phresco.testcases.iPhoneEshopTest]
    [TestNG] Running:
      /Users/yunfeiyang/快盘/Example/JavaCode/functional/src/test/resources/testsuite/testsuite.xml
    
    [SuiteRunner] Created 1 TestRunners
    [ThreadUtil] Starting executor timeOut:2147483647ms workers:1 threadPoolSize:5
    [TestRunner] Running test iPhoneHybEshopTest on 1  classes,  included groups:[] excluded groups:[]
    ===== Test class
    com.photon.phresco.testcases.iPhoneEshopTest
      @BeforeClass iPhoneEshopTest.setup(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testuserRegister()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForMobilePhone()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForCameras()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForAudioDevice()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testcheckOutScenario()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForComputer()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForMP3Players()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testLogin()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForMovieAndMusic()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForTablets()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testspecialOffers()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForVideoGames()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForTV()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
        @Test iPhoneEshopTest.testAddToCartForAccessories()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
      @AfterClass iPhoneEshopTest.tearDown()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
    ======
    [Invoker 614877437] Invoking @BeforeClass iPhoneEshopTest.setup(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
    九月 16, 2014 2:44:05 上午 AbstractBaseScreen launchDriver
    信息: EXCEPTION IN LAUNCHDRIVER No enum constant com.photon.phresco.enumscreen.LoadXmlParser.IPHONE SIMULATOR
    [Invoker 614877437] Invoking com.photon.phresco.testcases.iPhoneEshopTest.testLogin
    Executing Login Scenario
    九月 16, 2014 2:44:05 上午 AbstractBaseScreen waitForGivenTime
    信息: ENTERING WAIT FOR GIVEN TIME
    九月 16, 2014 2:44:08 上午 ImplementationScreen login
    信息: EXCEPTION IN LOGIN null
    [Invoker 614877437] Invoking com.photon.phresco.testcases.iPhoneEshopTest.testAddToCartForTV
    九月 16, 2014 2:44:08 上午 AbstractBaseScreen waitForGivenTime
    信息: ENTERING WAIT FOR GIVEN TIME
    Executing testAddToCartForTV Scenario
    九月 16, 2014 2:44:11 上午 ImplementationScreen addToCartForTV
    信息: EXCEPTION IN addToCartForTV null
    [Invoker 614877437] Invoking com.photon.phresco.testcases.iPhoneEshopTest.testcheckOutScenario
    九月 16, 2014 2:44:11 上午 AbstractBaseScreen waitForGivenTime
    信息: ENTERING WAIT FOR GIVEN TIME
    Executing checkOutScenario Scenario
    九月 16, 2014 2:44:14 上午 ImplementationScreen checkOutScenario
    信息: EXCEPTION IN checkOutScenario null
    [Invoker 614877437] Invoking @AfterClass iPhoneEshopTest.tearDown()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]
    九月 16, 2014 2:44:14 上午 AbstractBaseScreen quitDriver
    信息: ENTERING QUITDRIVER OPERATION
    ===== Invoked methods
      iPhoneEshopTest.setup(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524]iPhone simulator iOS 7.1  2109957412
        iPhoneEshopTest.testLogin()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524] 2109957412
        iPhoneEshopTest.testAddToCartForTV()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524] 2109957412
        iPhoneEshopTest.testcheckOutScenario()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524] 2109957412
      iPhoneEshopTest.tearDown()[pri:0, instance:com.photon.phresco.testcases.iPhoneEshopTest@7dc36524] 2109957412
    =====
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/Mydevice/iPhoneHybEshopTest.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/Mydevice/iPhoneHybEshopTest.xml
    PASSED: testLogin
    PASSED: testAddToCartForTV
    PASSED: testcheckOutScenario
    
    ===============================================
        iPhoneHybEshopTest
        Tests run: 3, Failures: 0, Skips: 0
    ===============================================
    
    
    ===============================================
    Mydevice
    Total tests run: 3, Failures: 0, Skips: 0
    ===============================================
    
    [TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms
    [TestNG] Time taken by org.testng.reporters.EmailableReporter2@4f47d241: 49 ms
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/toc.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/iPhoneHybEshopTest.properties
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/index.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/main.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/groups.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-alphabetical.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-alphabetical.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-alphabetical.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-alphabetical.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-alphabetical.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-alphabetical.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-alphabetical.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/classes.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/reporter-output.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/methods-not-run.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/Mydevice/testng.xml.html
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/old/index.html
    [TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@e6ea0c6: 80 ms
    [TestNG] Time taken by org.testng.reporters.jq.Main@67f89fa3: 51 ms
    [TestNG] Time taken by org.testng.reporters.XMLReporter@532760d8: 15 ms
    Creating /Users/yunfeiyang/快盘/Example/JavaCode/functional/test-output/junitreports/TEST-com.photon.phresco.testcases.iPhoneEshopTest.xml
    [TestNG] Time taken by org.testng.reporters.JUnitReportReporter@27ddd392: 7 ms
    
  • #8 楼 @cy_suncheng 不是 run 带参数的 xml,我是 run 截图中的 AndroidTest.java 时报错的,这个是 JUnit 测试入口

  • #6 楼 @cy_suncheng 是的啊,你眼里真好。。你直接看截图就好了,都是一样的问题。。

  • #4 楼 @lihuazhang 哦,之前是 device 的,后来我把所有的 device 换了 deviceName 这个我之后换了名称,跟这个没关系。

  • #1 楼 @cy_suncheng
    你看我这里是已经配置了么?

  • #1 楼 @cy_suncheng 这配置信息在哪里配置,请高手指教,我是新手,不知道如何配置呢。

  • #17 楼 @lihuazhang 你说的我知道,但这个问题比较棘手,还望前辈指教,不甚感激。

  • #15 楼 @link1220 嗯嗯,估计你那代码时实现滚动,没有下拉刷新的作用。

  • #13 楼 @link1220 你那能下拉刷新 tableView 么?

  • #11 楼 @link1220 或许跟 ios 7.x 的版本有关吧,暂时不知道,不过谢谢你,你说了这么多。

  • #9 楼 @link1220 后来我改过了坐标,还是不行,不管上拉还是下拉。

  • #7 楼 @link1220
    我这里问题以前就问过好几天了,论坛里面管理员都不回答,估计是没办法了吧。

  • #5 楼 @link1220 试过了,不行,再说,你给的坐标在我这里会报错,超出范围,苹果的界面,开始坐标哪有 978 的,另外,在 java 中,还有一个参数:Duration

  • #3 楼 @link1220 直接就可以在 swipe 方法中填写参数,不行的吧?

  • #1 楼 @gigayaya 缩短为 1 秒还都是一样的,要进行下拉拖拽的效果,才能够进行下拉刷新的。弄了好久了都不行,没有一个方法可行的到现在。

  • 很赞,这个问题困扰了我很多天,终于解决了。
    另外,我想请教一下,appium 中用 java 语言,下拉刷新视图以及多手势的问题,你也发一个帖子吧。我弄了好多天都没得出结果。有什么办法没有?估计很多人都有这样的疑问。

  • #5 楼 @luis 这个问题你弄出来了没有?

  • #5 楼 @luis
    下面的代码还是无法下拉显示 “松开即可刷新”,如下图:

    //        String js_snippet = "mobile: scroll";
    //        JavascriptExecutor js = (JavascriptExecutor) driver;
    //        HashMap<String, String> scrollObject = new HashMap<String, String>();   
    //        List<WebElement> elements = driver.findElementsByIosUIAutomation(".elements()");  
    //        scrollObject.put("element", ((RemoteWebElement) elements).getId()); 
    //        js.executeScript(js_snippet,scrollObject);
    
             JavascriptExecutor js = (JavascriptExecutor) driver;
    
             HashMap<String, Double> swipeObject = new HashMap<String, Double>();
              swipeObject.put("startx",75.0);
              swipeObject.put("starty",500.0);
              swipeObject.put("endx",75.0);
              swipeObject.put("endy",0.0);
              swipeObject.put("touchCount",0.5);
              swipeObject.put("duration",800.0);
    
    //       List<WebElement> elements = driver.findElementsByIosUIAutomation(".elements()");
             WebElement element = driver.findElementByIosUIAutomation(".elements()[0]");
             swipeObject.put("element", Double.valueOf(((RemoteWebElement) element).getId()));
    
             js.executeScript("mobile: swipe", swipeObject);