问题描述
Then I must see the specific text 'Lorem ipsum.\r\nLorem ipsum,lorem ipsum - lorem ipsum\r\nLorem ipsum.' in the text .error-message block on the page
步骤定义
[Then(@"I must see the specific text '(.*)' in the text (.*) block on the page")]
public void ThenISeeTheSpecificTextOnThePage(string expectedText,string textBlockName)
{
var actualText = driver.FindElement(By.CssSelector(textBlockName)).Text;
///var removeCaret = actualText.Replace(Environment.NewLine,string.Empty);
Assert.Contains(expectedText,actualText);
}
每次我在调试中运行此步骤时,我都会看到输出
> Assert.Contains() Failure
Not found: Lorem ipsum. Lorem ipsum,Lorem ipsum
In value: Lorem ipsum.
Lorem ipsum,Lorem ipsum
Lorem ipsum
我知道我可以修整\r\n
并在功能文件中调整我的输入参数。但这将是一个hack,我不想这么做。有机会断言多行文字吗?