Giter VIP home page Giter VIP logo

Comments (8)

xudafeng avatar xudafeng commented on July 19, 2024

Android 暂不支持 xpath,可以先用 ByClass 吗?

from macaca.

codingfishman avatar codingfishman commented on July 19, 2024

谢谢!是不是 elementByClassName? 如果是的话比较困难,因为同一个界面上有很多个同一类型的元素,而且有些元素是在其他元素之内的,在展开该元素之前还不知道有这个元素(借助appium获取type),因此比较难获取到index。 尝试了一下class嵌套,但是失败了。

from macaca.

xudafeng avatar xudafeng commented on July 19, 2024

@codingfishman 能稍微描述下什么样的场景吗

from macaca.

codingfishman avatar codingfishman commented on July 19, 2024

谢谢,好的。
其实是已经进入到APP的首页,需要点击底部的菜单再进入相应的面板。首页内容比较复杂,元素类型也有很多种(目前是这样的。。),通过elementByClassName会取到比较多的元素,不是像Demo中只有两个输入框。

底部的菜单栏最底层叫做android.widget.TextView, 再上一层是一个relativeLayout, 但这两个在页面上都是有不少个。TextView更多,在不同的元素嵌套下都有这个,所以elementByClassName以后不太好定位。后面如果开发在里面又加了新的TextView, 测试用例中的index也要更新。

我们主要是想把我们这个工具交给QA来使用,希望他们通过Appium能比较方便的找到对应元素的selector,也可以让测试代码更直观一些。所以如果能够支持 elementByXPath('//android.widget.TextView[@text="消息"]'), 那么将会很有帮助。

再次感谢!

from macaca.

xudafeng avatar xudafeng commented on July 19, 2024

@codingfishman 先用source-id 可以吗?elementById

from macaca.

xudafeng avatar xudafeng commented on July 19, 2024

https://github.com/macacajs/uiautomator-client/pull/13

from macaca.

xudafeng avatar xudafeng commented on July 19, 2024

@kobe990 xpath功能好了吗?

https://testerhome.com/topics/5883#reply5

from macaca.

xudafeng avatar xudafeng commented on July 19, 2024

https://testerhome.com/topics/5888

from macaca.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.