我正面临着量角器的新问题, 当我尝试使用这种硒方法时:
ExpectedConditions.textToBePresentInElement
它返回false,因为我的元素返回了这个消息: 连接不可用。 此时无法连接到设备
这是我期望的字符串:
消息:连接不可用。\ n此时无法连接到设备
然后我的方法调用是:
browser.wait(ExpectedConditions.textToBePresentInElement(element, message), 160000, 'The expected text is not present in the UI');
也许有人可以帮助我
答案 0 :(得分:1)
也许这不是最好的方法,但它会解决你的问题。只需将您的预期消息替换为没有\n
的消息:
browser.wait(ExpectedConditions.textToBePresentInElement(element, message.replaceAll("\\n", " ")),
160000, 'The expected text is not present in the UI');