首先,我想指出我在“Hello,World!”水平,具有非常有限的编码能力,我正在寻求在自动化测试(目前仅手动)的进展,我刚刚遇到一个问题,大概是我的selenium webdriver,这是我得到的问题: 这是我的代码:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace UnitTestProject2
{
[TestClass]
public class FirstSoftwareAuto
{
[TestMethod]
public void First_Software_Login()
{
IWebDriver driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
driver.Navigate().GoToUrl("//companyproductwebsite");
IWebElement addUser = driver.FindElement(By.Name("Username"));
addUser.SendKeys("//email");
}
}
}
老实说,我不确定问题是什么,这是我在微软视觉工作室左下角的错误:
我公司的一位有帮助的程序员提到它是因为它试图连接到localhost,但是我不明白为什么它没有连接到互联网。
Test Name: First_Name_Login
Test FullName: UnitTestProject2.FirstVantAuto.First_Software_Login
Test Source: c:\users\Name\documents\visual studio 2015\Projects\UnitTestProject2\UnitTestProject2\UnitTest1.cs : line 15
Test Outcome: Failed
Test Duration: 0:00:49.1936095
Result StackTrace:
at OpenQA.Selenium.Firefox.FirefoxDriverServer.ConnectToBrowser(TimeSpan timeToWait)
at OpenQA.Selenium.Firefox.FirefoxDriverServer.Start()
at OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor()
at UnitTestProject2.FirstSoftwareAuto.First_Software_Login() in c:\users\name\documents\visual studio 2015\Projects\UnitTestProject2\UnitTestProject2\UnitTest1.cs:line 16
Result Message:
Test method UnitTestProject2.FirstSoftwareAuto.First_Software_Login threw exception:
OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055
非常感谢任何意见。