Selenium C#:添加explicitwait函数
本文关键字:explicitwait 函数 添加 Selenium | 更新日期: 2023-09-27 18:30:05
我正试图向我的项目添加一个显式等待函数,但我收到了一个错误
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) ;
(PropertiesCollection.driver, 1000)
处出错。我是不是遗漏了什么?
错误描述:
错误1:的最佳重载方法匹配'OpenQA.Selemenium.Support.UI.WebDriverWait.WebDriverWait(OpenQA.Selenium.IWebDriver,System.TimeSpan)'具有一些无效的参数
错误2:无法将"int"转换为"System.TimeSpan"
- 您的
PropertiesCollection
类是私有的(C#中的默认类),请将其公开(它看起来与您发布的类不同) WebDriverWait
得到时间跨度new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(10));