0

我需要验证多行警报中的文本,但我真的无法让它工作。

警报类似于:

- Please enter firstname:
- Please enter lastname:
- ..............................

我使用:

verifyEquals("Verify msg",
        ObjectHelp.closeAlertAndGetItsText(true),
        "Please enter firstname:Please enter lastname:");

但由于某种原因,它给了我 FALSE !

我尝试调试并且警报文本实际上是“请输入名字:请输入姓氏:”所以,毫无疑问。

如何管理多行警报?

4

1 回答 1

1

I bet the actual text of the alert is not "Please enter firstname:Please enter lastname:".

It's more likely "Please enter firstname:\nPlease enter lastname:" (notice the \n).

You should confirm this in the page source, or the JS file containing the call.

Anyway, the right thing to assert here is

verifyEquals("Verify msg",
        ObjectHelp.closeAlertAndGetItsText(true),
        "Please enter firstname:\nPlease enter lastname:");
于 2013-07-16T17:45:29.987 回答