Automation developer

  • 用 robot 工具,具体如下:
    Robot robot = new Robot();
    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_V);

  • #7 楼 @luobs

    1. Remove or rename your current Appium.
    2. Reinstall Appium
    3. Brew uninstall libimobiledevice
    4. Brew install libimobiledevice --HEAD
    5. Add team to your WebDriverAgent.xcodeproj and run it in Xcode
    6. Run your test It works for me.
  • #12 楼 @neyo 我就是被这个坑爹的 xcuitest 给害了,我的 app 不能用 id 等常规定位,我大量采用 ios predicate,手机升级到 iOS10 无法降级到 9 了,Appium、xcode 被迫升级,结果大部分定位失败,我写了那么多 test cases,不可能改成 hard code 的 xpath,只能有 java-client 从 4.1.2 升级到 5.0,5.0 支持 nspredicate,类似 ios predicate,等了好几周 5.0 还没 release,我只好暂停 ios 自动测试,制作 Android 了。

  • #5 楼 @hcc3352779 谢谢回复!我今天试着不切换到 webview,也无法定位元素。btw,我觉得 appium 不太严谨,有些 webview 页面不切换到 webview 反而能定位、操作,比如我这个 app 的 log in 界面就是,以前的测试开发写的注释里说无法获取元素,以后解决了再完成 log in 功能测试,我试了不用切换 webview 反而可以操作,这个测试反而完成了。

  • 今天在办公室花了一些时间又试了一下,还是不行,具体如下:

    1. debugged 测试代码,for (String s : contexts) 是得到 2 个值,并且 driver.context(s) 在 android 4.4.4 得到和 5.0.1 一样的 webview 值(具体值忘了,在办公室电脑),并且最后返回值是 true,说明切换 webview 成功的。
    2. 在后面定位元素的时候每次都提示元素 galleryIndicator = null,所以无法走到下一步 click galleryIndicator 了
    3. 用 uiautomatorview 可以定位到元素,但是看到的 class name 和在 appium inspector 及 chrome inspector 上看到的不同,在 appium inspector 和 chrome inspector 可以查到正确的元素 id 和 class name。
    4. 在 Android 5.0.1 上可以切换到 webview,并且找到元素,然后点击元素,而在 4.4.4 可以切换 webview,但是无法找到元素 (元素=null),当然更不能操作元素了。

    没有贴 log,因为 log 的结果都是我写的判断(assertion),而且通过 debug 已经定位出是可以切换 webview 而不能找到元素。等我定的 mac mini 到货就可以贴 log 了,因为公司 mac 不能输入中文,用 tablet 打字太慢。

    该问题我 google 了很久没有找到解决方案,所以特此来请教,谢谢!

  • #9 楼 @quqing 请问能说具体一点吗?我几次都是重启电脑、重启手机后运行的测试程序,也不行。

  • #6 楼 @quqing 切换正常但是切换后找不到元素。在安卓 5 正常

  • #5 楼 @hcc3352779 谢谢回复。我去试一下,因为在安卓 5 是切换并找到元素的。

  • @lihuazhang 第一次在国内测试论坛发帖,哪里有问题还望指点,谢谢

Automation developer