- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个包含 TextView 的布局,如下所示,它将在文本 block 中包含一些自动生成的链接。当用户单击链接时,会打开一个包含相关信息的窗口。
但是,我完全不知道如何让 Espresso 点击链接。已经尝试过类似
的多种变体匹配(withText(containsString(“45”)))
但这要么不起作用,要么让 Espresso 只需点击文本框本身,而这不会执行任何操作。
有什么办法吗?在 Espresso 的限制范围内甚至有可能吗?
最佳答案
您可以使用 openLinkWithText(String linkText)
Returns an action that opens a link matching the given link text and uri matchers. The action is performed by invoking the link's onClick method (as opposed to actually issuing a click on the screen).
这是一个如何使用它的例子:
Espresso.onView(ViewMatchers
.withId(R.id.your_text_view_id))
.perform(ViewActions.openLinkWithText("45"));
关于android - Espresso 单击 Textview 中的特定子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54394167/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
正如您在 this travis.yml 中看到的那样文件,我的代码依赖于一些第三方库,我在构建项目之前将它们安装在远程系统上。 Travis 每次推送提交时都会下载并构建这些库,这可以避免吗?我的意
我是一名优秀的程序员,十分优秀!