【发布时间】:2022-03-01 14:42:16
【问题描述】:
我正在尝试为“ElementIsVisible”编写通用代码,以便可以在多个地方使用通用代码。我不断收到此错误。我该如何纠正这个问题?
Error CS1061 'Shared' does not contain a definition for 'SendKeys' and no accessible extension method 'SendKeys' accepting a first argument of type 'Shared' could be found (are you missing a using directive or an assembly reference?
这是我的代码
public Shared WaitUntilElementIsVisible(By by)
{
WebDriverWait wait = new WebDriverWait(Driver.Instance.webDriver, TimeSpan.FromSeconds(20));
wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(by));
return this;
}
public Page Physician(string physician)
{
var WeekStarted = PrShared.Page.WaitUntilElementIsVisible(By.XPath("//input[@id='fyd_weekStarted']"));
WeekStarted.SendKeys(weekStarted);
return this;
}
**TO TEST**
Test.Page.Physician(Data.WeekStarted)
【问题讨论】:
标签: c# selenium selenium-webdriver