Selenium C#:添加显式Wait函数
我试图向我的项目添加一个显式等待函数,但收到一个错误Selenium C#:添加显式Wait函数,c#,selenium,C#,Selenium,我试图向我的项目添加一个显式等待函数,但收到一个错误 namespace AutoProj { enum PropertyType { Id, Name, LinkText, CssName, ClassName } class PropertiesCollection { //autoimplemented properties public
namespace AutoProj
{
enum PropertyType
{
Id,
Name,
LinkText,
CssName,
ClassName
}
class PropertiesCollection
{
//autoimplemented properties
public static IWebDriver driver { get; set; }
}
main.cs
[TestFixture(typeof(FirefoxDriver))]
[TestFixture(typeof(InternetExplorerDriver))]
[TestFixture(typeof(ChromeDriver))]
public class TestWithMultipleBrowsers<TWebDriver> where TWebDriver : IWebDriver, new()
{
[Test]
public void TestCase_Abc()
{
WebDriverWait wait = new WebDriverWait(PropertiesCollection.driver, 1000) ;
[TestFixture(typeof(FirefoxDriver))]
[测试夹具(类型(InternetExplorerDriver))]
[测试夹具(ChromeDriver类型))]
带有多个浏览器的公共类测试,其中TWebDriver:IWebDriver,new()
{
[测试]
公共无效测试用例_Abc()
{
WebDriverWait wait=新的WebDriverWait(PropertiesCollection.driver,1000);
(PropertiesCollection.driver,1000)
处出错。我在这里遗漏了什么吗
错误说明:
错误1:的最佳重载方法匹配
'OpenQA.Selenium.Support.UI.WebDriverWait.WebDriverWait(OpenQA.Selenium.IWebDriver,
System.TimeSpan“”具有一些无效参数
错误2:无法从“int”转换为“System.TimeSpan”
- 您的
类是private(C#中的默认值),将其公开(它看起来与您发布的类不同)PropertiesCollection
获取时间跨度WebDriverWait
newwebdriverwait(PropertiesCollection.driver,TimeSpan.FromSeconds(10));
wait.until(ExcepctedConditions.elementtobelickable(NextTab));
你知道为什么吗?[FindsBy(How=How.LinkText,Using=“Next Tab”)]public IWebElement NextTab{get;set;}
@AJ1110在C#中应该是wait.until(ExpectedConditions.ElementIsClickable(By.LinkText(““下一个选项卡”));
注意ElementIsClickable
和中的大写字母,直到
“OpenQA.Selenium.Support.UI.ExpectedConditions”不包含“ElementIsClickable”的定义