We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
但是实测发现,按照如下方式启动watcher: d.xpath.when("跳过").click() d.xpath.watch_background() d.xpath('//*[@resource-id="com.map:id/play"]').click()
watcher的逻辑是在后台循环执行。当点击"play"播放按钮时,虽然按钮被弹窗遮挡,仍然会去点击”play“,此时因为”play“被弹窗遮挡,所以没有点击成功,也不会抛异常。 并不会执行像XPATH.md描述的,“检查”play“按钮前,先检查弹窗,如果有弹窗就点击"的逻辑。
The text was updated successfully, but these errors were encountered:
提供一个自行实现的思路
import uiautomator2 as u2 d = u2.connect() source = d.xpath.get_page_source() # 处理弹窗 elements = source.find_elements('//*[@text="关闭"') if elements: x, y = elements[-1].center() d.click(x, y) d.xpath('Play').click()
半伪代码仅供参考
Sorry, something went wrong.
No branches or pull requests
按照XPATH.md的描述,弹窗监控原理是:
1.获取到当前界面的XML(通过dump_hierarchy函数)
2.检查有没有 跳过, 知道了 这两个按钮,如果有就点击,然后回到第一步
3.检查有没有播放按钮, 有就点击,结束。没有找到在回到第一步,一直执行到查找次数超标。
但是实测发现,按照如下方式启动watcher:
d.xpath.when("跳过").click()
d.xpath.watch_background()
d.xpath('//*[@resource-id="com.map:id/play"]').click()
watcher的逻辑是在后台循环执行。当点击"play"播放按钮时,虽然按钮被弹窗遮挡,仍然会去点击”play“,此时因为”play“被弹窗遮挡,所以没有点击成功,也不会抛异常。
并不会执行像XPATH.md描述的,“检查”play“按钮前,先检查弹窗,如果有弹窗就点击"的逻辑。
The text was updated successfully, but these errors were encountered: