我对selenium很新,我试图测试我的应用程序的给定功能。我有一个多行输入,我在其中输入以下内容:
bla bla blafoo bar
其中,一旦被硒读取就被翻译为
bla bla bla\r\nfoo bar
Scenario: Someone does some typing
When I open the input
Then I can read
| Input |
| bla bla bla\r\nfoo bar |
当我调试测试时,从debbuger中查看的表中的值是:
bla bla bla\\r\nfoo bar
^ note the extra backslash
我不明白这个反斜杠的来源。任何线索?
代码:
namespace Selenium.SpecFlow.Steps
{
[Binding]
public class WorkflowUrgenceSteps
{
private readonly OpenConsutationPage _openConsutationPage;
[...]
[Then(@"I can read")]
public void ThenICanRead(Table table)
{
var expectedInfos = table.CreateInstance<NewUrgentRequest>();
Assert.AreEqual(expectedInfos.Input, _openConsutationPage.GetInput());
}
}
}
和
namespace Selenium.Pages
{
public class OpenConsutationPage : PageBase
{
public string GetInput()
{
var input = By.CssSelector("blockquote>p>b");
Wait.Until(ExpectedConditions.ElementIsVisible(input));
return Driver.FindElement(input).Text;
}
}
}