Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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
Selenium C#:添加显式Wait函数_C#_Selenium - Fatal编程技术网

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”

  • 您的
    PropertiesCollection
    类是private(C#中的默认值),将其公开(它看起来与您发布的类不同)
  • WebDriverWait
    获取时间跨度
    newwebdriverwait(PropertiesCollection.driver,TimeSpan.FromSeconds(10));

另一个问题:我在嵌套行接收到错误。在until和ExpectedCondition
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”的定义