Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提个需求,在list中取某一个有标识节点的前面或者后面一个兄弟节点 #972

Open
jjjack230 opened this issue May 11, 2024 · 3 comments

Comments

@jjjack230
Copy link

245D92B805222BD1D47E8E40655BE083_副本
像这种,list里面有10多个一样的classname,但又不同的节点。
现在通过left、right()函数实现,特别慢。
如果有更好的实现方式,该多好!

感谢大神开源,用起来特别好!尤其是新版。安利大家使用新版

@oatwaybt
Copy link

什么叫标识节点

@jjjack230
Copy link
Author

就是具有唯一性的,id或者desc 或者其他的什么标识

@codeskyblue
Copy link
Member

提案

基于xpath插件,使用>>代表右侧元素

import uiautomator2 as u2

P = u2.XPath
card_xpath = P("证件类型") >> P(className="android.view.View")
el = d.xpath(card_xpath).get()
el.click()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants