[英]Could not load file or assembly 'SeleniumExtras.WaitHelpers
[英]SeleniumExtras.WaitHelpers.ExpectedConditions
我写了以下内容:
double waitTime = 10;
new WebDriverWait(driver, TimeSpan.FromMilliseconds(waitTime).until
(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//input[@id='usernameOrEmail']"))).sendKeys("John Doe"));
我在上面的代码中得到的错误是“TimeSpan”不包含“直到”的定义。我的印象是“直到”是“SeleniumExtras.WaitHelpers”库的一部分?
如果您使用的是c#,我认为您只需要几个印刷修正即可。 正如@Guy所提到的,直到之前您都缺少右括号。 同样,方法Until
和SendKeys
需要以C#中的大写字母开头。 所以我认为应该
double waitTime = 10;
new WebDriverWait(driver, TimeSpan.FromMilliseconds(waitTime)).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//input[@id='usernameOrEmail']"))).SendKeys("John Doe"));
或者我认为将等待时间分成两行会更加清楚:
double waitTime = 10;
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromMilliseconds(waitTime));
wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//input[@id='usernameOrEmail']"))).SendKeys("John Doe"));
我的一个悬而未决的问题是关于您的等待时间-10毫秒? 这样就可以等待最多10毫秒,这是您想要的吗?
wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//input[@id='usernameOrEmail']"))).SendKeys("John Doe"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.