运行Selenium测试时,Promise.resolve不是函数错误

时间:2019-12-02 11:54:07

标签: c# selenium selenium-chromedriver nunit

我用Chrome的Selenium IDE记录了一个简单的测试(打开页面并登录)。我将此测试导出为c#NUnit并运行它,但是我看到此错误:

Message: OpenQA.Selenium.WebDriverException : unknown error: Runtime.evaluate threw exception: TypeError: Promise.resolve is not a function
    at callFunction (<anonymous>:458:20)
    at <anonymous>:461:23
    at <anonymous>:462:3
  (Session info: chrome=78.0.3904.108)

下面有代码,有人可以帮助我吗?

// Generated by Selenium IDE
using System.Collections.Generic;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using NUnit.Framework;
[TestFixture]
public class Login
{
    private IWebDriver driver;
    public IDictionary<string, object> vars { get; private set; }
    private IJavaScriptExecutor js;
    [SetUp]
    public void SetUp()
    {
        driver = new ChromeDriver();
        js = (IJavaScriptExecutor)driver;
        vars = new Dictionary<string, object>();
    }
    [TearDown]
    protected void TearDown()
    {
        driver.Quit();
    }
    [Test]
    public void login()
    {
        // Test name: Login
        // Step # | name | target | value | comment
        // 1 | open | /umc-idp/idpauthsite/index.html |  | 
        driver.Navigate().GoToUrl("http://uadm-30/umc-idp/idpauthsite/index.html");
        // 2 | setWindowSize | 1936x1186 |  | 
        driver.Manage().Window.Size = new System.Drawing.Size(1936, 1186);
        // 3 | click | id=windowsAuthenticationFirstPage |  | 
        driver.FindElement(By.Id("windowsAuthenticationFirstPage")).Click();
    }
}

0 个答案:

没有答案