因此,我正在 Web 应用程序上使用 Selenium Web Driver(使用 PhantomJS 作为无头浏览器)运行自动化 UI 测试。当我在测试中达到某个点时——Web 应用程序需要超过一分钟才能加载下一个页面(有时长达 3 分钟)——它将失败。
我收到以下错误消息:
结果消息:
测试方法 UI_Tests.UT_GI_Template.Delivery_UI 抛出异常:OpenQA.Selenium.WebDriverException:对 URL http://localhost:45539/session/94ef38f0-a528-11e7-a7fd-69a0e29e333f的远程 WebDriver 服务器的 HTTP 请求 /:wdc:1506697956275/值 在 60 秒后超时。---> System.Net.WebException: 请求已中止:操作已超时。
我已将等待时间间隔设置为 300 秒,但它总是在 60 秒后超时。有没有人遇到过这个错误?这是我的代码:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.PhantomJS;
namespace UI_Tests
{
[TestClass]
public class UT_GI_Template {
private RemoteWebDriver wd;
[TestMethod]
public void Delivery_UI()
{
IWebDriver wd = new PhantomJSDriver();
try
{
WebDriverWait wait = new WebDriverWait(wd, new TimeSpan(0, 0, 300)); …Run Code Online (Sandbox Code Playgroud)