测试之家
  • Topics
  • QA
  • 招聘
  • 社区学堂新
  • 开源项目
  • 活动
  • Wiki
  • Sign Up
  • Sign In
新手
jennyhui (JennyHui)
第 1505 位Users / 2014-08-30
3 篇帖子 • 162 条回帖
45 关注者
24 正在关注
48 收藏
学而不思则罔,思而不学则殆
GitHub Public Repos
  • appiumDemo 33

    appium,python,java

  • jmeter_java_demo 1

    jmeter调用jar包

  • drawdrawdraw 0

  • lc_start 0

    佛系刷题

  • javaHomeWork 0

    jennyhui java homework

  • JavaGuide 0

    「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,首选 JavaGuide!

  • fucking-algorithm 0

    刷算法全靠套路,认准 labuladong 就够了!English version supported! Crack LeetCode, not only how, but also why.

  • tutorials 0

    Just Announced - "Learn Spring Security OAuth":

  • byteman 0

    Byteman Project main repo

  • gitlearning 0

More on GitHub
  • 个人信息
  • 专栏
  • 话题
  • 回帖
  • 收藏
  • 关注中
  • 关注者
  • API 自动化测试框架分享 at October 12, 2015

    mark~

  • 多维度分析:抽象类和接口的区别 at September 15, 2015

    赞赞赞!!! 最近正在思考这些东西呢!!!

  • python+appium 切换 WEBVIEW 时,经常报错 at September 15, 2015

    现在 appium 支持 H5 了~定位 webview 内的元素妥妥的~至少我们的应用没问题~

  • 中文 webdriver API 文档 at September 06, 2015

    二妹子!!!

  • 在 Java 中如何更高效地存储和管理 SQL 语句? at August 20, 2015

    还是喜欢 mybatis 多些

  • appium 自动化分享和请教 at August 18, 2015

    同 @shixue33 妹子的想法 想借助 django 不过具体的想法可能不一样 再说再说

  • appium Bootstrap UiSelectorParser 源码分析 at August 07, 2015

    #10 楼 @zsx10110 嗯嗯很喜欢您的学习风格啊大赞~~学习学习了~thx

  • appium Bootstrap UiSelectorParser 源码分析 at August 07, 2015

    #8 楼 @zsx10110 赞赞赞!!! 不过这种方式我真是没用过 :plus1: 太厉害了 ~!!!

  • appium Bootstrap UiSelectorParser 源码分析 at August 07, 2015

    #6 楼 @zsx10110

    没有这种用法。
    其实分号不加可以定位到,那就不用加了。定位多个元素 appium 有封装好的方法可以直接用。

  • appium Bootstrap UiSelectorParser 源码分析 at August 06, 2015

    #3 楼 @zsx10110 关于你的最后一个问题

    private void consumeStatement() throws UiSelectorSyntaxException {
        String statement;
        int index = 0;
        int parenCount = -1; // semicolons could appear inside String arguments, so we make sure we only count occurrences outside of a parenthesis pair
        while (index < text.length()) {
          if (text.charAt(index) == ';' && parenCount == 0) {
            break;
          }
          if (text.charAt(index) == '(') {
            if (parenCount < 0) {
              parenCount = 1;
            } else {
              parenCount++;
            }
          }
          if (text.charAt(index) == ')') {
            parenCount--;
          }
          index++;
        }
    

    driver.findElement(MobileBy.AndroidUIAutomator("new UiSelector().index(0)"));

    你把定位脚本传入得字符串放进去就知道了。
    定义了一个 parenCount=-1 做标示;
    遇到"(" -> parenCount=1
    遇到")" -> parentCount--
    所以 parenCount 最后肯定等于 0。
    而传入的字符串是允许有 “;” 的,只不过只能放在分号外 (semicolons could appear inside String arguments, so we make sure we only count occurrences outside of a parenthesis pair)
    所以也就是在解析字符串时,到了最后一个字符如果是";"就直接 break;如果不是那就 index++,最后也是不符合 while 条件跳出来的~

  • appium Bootstrap UiSelectorParser 源码分析 at August 06, 2015

    #3 楼 @zsx10110 卧槽! 就是喜欢你这种人! 👏 我先 mark 着~明天再来看你这一段研究啊哈哈哈 😄

  • appium Bootstrap UiSelectorParser 源码分析 at August 06, 2015
    • 定位脚本

      WebElement el = driver.findElementsByAndroidUIAutomator("new UiSelector().className(android.widget.ListView).childSelector(new UiSelector().className(android.widget.LinearLayout).clickable(true))");
      
    • 打开 findElementByAndroidUIAutomator 方法

    @SuppressWarnings("unchecked")
    @Override
    public RequiredElementType findElementByAndroidUIAutomator(String using) {
        return (RequiredElementType) findElement("-android uiautomator", using);
    }
    
    • 再打开 findElement("-android uiautomator", using) // 是 webdriver 的方法
    protected WebElement findElement(String by, String using) {
        if(using == null) {
            throw new IllegalArgumentException("Cannot find elements when the selector is null.");
        } else {
            Response response = this.execute("findElement", ImmutableMap.of("using", by, "value", using));
            Object value = response.getValue();
    
            WebElement element;
            try {
                element = (WebElement)value;
            } catch (ClassCastException var7) {
                throw new WebDriverException("Returned value cannot be converted to WebElement: " + value, var7);
            }
    
            this.setFoundBy(this, element, by, using);
            return element;
        }
    }
    

    大概有点了解了 不过再底层一点的 就没看了

    btw 楼主解析代码 一步步走 真好 很清晰呢 赞赞赞~

  • 2015 年 3 月 新秀群作业-- Appium+Python+PO 设计模式 入门笔记 at August 05, 2015

    #49 楼 @laiyuncong8404
    可以把 driver 的实例化封装在一个类方法内~(这是其中的一个方法而已)
    不过如果后期希望做到不同设备不同 driver 跑同一份测试脚本(或者其他并发策略)就要另外对 driver 做其他处理(论坛内有不少帖子实现了并发的功能了)

    #BasePage
    
        //初始化driver
        public AndroidDriver SetDriver() throws MalformedURLException {
            try{
                driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), this.SetCa());
    
            }catch (MalformedURLException e){
                e.printStackTrace();
            }
            return driver;
        }
    
    #DashPage
    
        /**
         * 业务封装
         */
    
        //搜索 - 收藏
        public void Search(String recipe,Class name) throws IOException, InvalidFormatException {
            LoggerControler log = this.MyLogger(name);
            AndroidDriver driver = super.SetDriver();
            this.ClickSearchBox();
            this.InputRecipe(recipe);
            log.info("本次搜索的食材是:"+recipe);
            driver.sendKeyEvent(66);
            this.ClickCollectionItem();
            //this.ClickFavorite();
            log.info("收藏的菜谱名为:"+this.GetRecipeName());
            super.captureScreen("Search_"+recipe);
            Assert.assertTrue(GetRecipeName().contains(recipe));
            log.info("该Case测试通过");
        }
    
  • [已解决] 测试小白的种种疑惑 at August 05, 2015

    谢谢大家的回复和建议 👌

  • appium + xml + web 自动化测试框架设想及实践分享 at July 18, 2015

    #13 楼 @xushizhao 好的。等你的分享 ~

  • [已解决] 测试小白的种种疑惑 at July 18, 2015

    #2 楼 @mads 现在的公司平均一个礼拜加 2 天吧。算是我加最多的公司了啊哈哈。如果是上海的新公司的话,加不加班,没有特别所谓了。反正一个人在外地,也就那样了,就是折腾呗。

  • [已解决] 测试小白的种种疑惑 at July 18, 2015

    或许自己不应该考虑这么多的 性格问题伤不起 😩

  • MTSC 2015 (711 大会) 后感及工作两年总结 at July 14, 2015

    我表示很崇拜楼主。努力 ing 😄

  • appium + xml + web 自动化测试框架设想及实践分享 at July 13, 2015

    1.如果一个页面的同一个元素,在同一个 case 中, 不同时间做不同的操作,是写两个,还是定义两个,xml 解析成脚本时在做处理?
    2.你们是用 UIautomator 把页面元素 dump 下来再去编辑修改维护 xml 吗?一个页面一个 xml。你们现在管理编辑起来感觉方便吗?
    3.web 平台上显示的 html 点击运行开始解析脚本跑用例,这挺好的。以后你们的可以平台化了。
    4.谢谢楼主的分享。

  • 2015 年 3 月 新秀群作业-- Appium+Python+PO 设计模式 入门笔记 at July 10, 2015

    #47 楼 @louqqson008 appium 暂不支持哦~robotium 可以~appium 未来应该会支持~

  • 2015 年 3 月 新秀群作业-- Appium+Python+PO 设计模式 入门笔记 at July 09, 2015

    #45 楼 @louqqson008 嗯。如果你觉得项目合适,可以用这种方式。不过我觉得 PO 不是最优方案。你可以了解下关键字。

  • Facebook/atc 环境搭建总结 at July 06, 2015

    赞赞赞 不懂 windowns 做热点可以设置吗

  • 2015 年 3 月 新秀群作业-- Appium+Python+PO 设计模式 入门笔记 at July 02, 2015

    #42 楼 @very 你是谁呢?

  • 2015 年 3 月 新秀群作业-- Appium+Python+PO 设计模式 入门笔记 at July 02, 2015

    #34 楼 @very 认识? 😪

  • 2015 年 3 月 新秀群作业-- Appium+Python+PO 设计模式 入门笔记 at July 02, 2015

    #39 楼 @lework 不是。appium 启动只开一个 session。测试集内的是按照你 testcase 顺序跑的。

  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next
  • 关于 / 活跃用户 / 中国移动互联网测试技术大会 / 反馈 / Github / API / 帮助推广
    TesterHome社区,测试之家,由众多测试工程师组织和维护的技术社区,致力于帮助新人成长,提高测试地位,推进质量发展。Inspired by RubyChina
    友情链接 WeTest腾讯质量开放平台 / InfoQ / 掘金 / SegmentFault / 测试窝 / 百度测试吧 / IT大咖说
    简体中文 / 正體中文 / English

    ©testerhome.com 测试之家   渝ICP备2022001292号
      渝公网安备 50022202000435号    版权所有 © 重庆年云聚力信息技术有限公司