Robotium:solo.waitForText()和solo.searchText()没有声明特殊字符

时间:2013-10-17 09:57:31

标签: android robotium

我试图断言“abcd:移至历史”。 所以我的代码是这样的:

assertTrue(“消息未显示”,solo.searchText(“abcd:移至历史”));

此时我的测试脚本失败了,尽管屏幕上出现了消息“abcd:move to history”。

如果代码如下:assertTrue(“消息未显示”,solo.searchText(“移至历史记录”));它有效!!

所以solo.waitForText()和solo.searchText()方法没有识别文本中的特殊字符,如:,?等

对此有何解决方案?

1 个答案:

答案 0 :(得分:1)

我认为你应该这样写:

assertTrue("Message not shown", solo.searchText(Pattern.quote("abcd : moved to history")));