Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 阿塔塔–;是否有相当于等待的功能?_C#_Selenium_Automated Tests_Atata - Fatal编程技术网

C# 阿塔塔–;是否有相当于等待的功能?

C# 阿塔塔–;是否有相当于等待的功能?,c#,selenium,automated-tests,atata,C#,Selenium,Automated Tests,Atata,在我正在使用的场景中,需要等待出现预期条件,如值,值具有预期文本或状态,或者等待更复杂的规则生效,例如: Wait.Until(x => x.UserName.Value.Get() != string.Empty) 给定Selenium方法,Atata框架中是否有任何等效功能 我看到有很多属性,比如Until,WaitFor,WaitForElement,但这些都是用于简单场景的。对于更复杂的规则,我需要类似的功能。如何使用Atata实现这一点?您可以使用组件的Should.*扩展方法

在我正在使用的场景中,需要等待出现预期条件,如值,值具有预期文本或状态,或者等待更复杂的规则生效,例如:

Wait.Until(x => x.UserName.Value.Get() != string.Empty)
给定Selenium方法,Atata框架中是否有任何等效功能


我看到有很多属性,比如
Until
WaitFor
WaitForElement
,但这些都是用于简单场景的。对于更复杂的规则,我需要类似的功能。如何使用Atata实现这一点?

您可以使用组件的
Should.*
扩展方法来实现这一点

page.SomeSpan.Should.Equal("smth"); // Checks for text in some <span> element.
等等。。。您可以检查其他方法的
Atata.IDataVerificationProviderExtensions
Atata.IUIComponentVerificationProviderExtensions
类。对于阴性检查,只需在“应该”之后添加“不”:
Should.Not.*
。对于自定义条件,还有
Should.sulfit()
方法

page.SomeSpan.Should.Within(30).StartWith("smth"); // Wait for condition within 30 seconds.
page.SomeSpan.Should.AtOnce.Contain("smth"); // Without retries, quickly checks and throws if condition doesn't match.
page.SomeSpan.Should.Not.BeNullOrEmpty(); // Wait for any value in <span>.
page.SomeTable.Rows.Should.Not.BeEmpty();
page.SomeTable.Rows.Count.Should.BeGreaterOrEqual(1);