Timed out waiting for async script result Selenium

2019-04-09 18:43发布

问题:

I'm trying to create an automation test script using Protractor.net for an AngularJS platform, with Selenium in C#. I've created the driver using the below code.

driver = new FirefoxDriver();
Ngdriver = new NgWebDriver(driver);

And then attempted to locate and element as follows:

Ngdriver.FindElement(NgBy.Model("vm.reference")).SendKeys("Test");

However, I'm receiving an exception: Timed out waiting for async script result after 45ms.

Thanks in advance

回答1:

I resolved this by using the SetScriptTimeout.

ngDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));