什么会导致点击操作在60秒后超时?

时间:2017-08-06 10:37:21

标签: c# selenium webdriver

什么会导致点击操作在60秒后超时?我抛出一个异常,即使该元素清楚地显示在页面中并且是可点击的(我在点击之前进行了ExpectedConditions.ElementToBeClickable检查)。 OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://grid:4444/wd/hub/session/9e9693f0-0288-47a1-97f9-8f61c300bc41/element/29/click timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out

WebDriverWait wait = new WebDriverWait(this.driverController.driver, TimeSpan.FromSeconds(30.00));
IWebElement clickThis;
wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("elementId")));
clickThis = this.driverController.driver.FindElement(By.Id("elementId"));
clickThis.Click();

例外情况发生在clickThis.Click()

谢谢,

1 个答案:

答案 0 :(得分:1)

您的异常表示它是导致超时的selenium网格集线器。集线器本身有一个超时,它的工作原理如下面的selenium文档中所述:

  

-timeout 30(默认为300)在集线器自动释放未收到任何请求的节点之前的超时(以秒为单位)   超过指定的秒数。在此之后,节点   将被释放用于队列中的另一个测试。这有助于清除   客户端崩溃而无需人工干预。删除超时   完全,指定-timeout 0并且集线器永远不会释放   节点

如果问题与找到您想要与之互动的元素有关,那么您应该收到NoSuchElementException或类似的。

相关问题