【发布时间】:2014-08-06 09:49:42
【问题描述】:
我使用在 Firefox 中工作的 selenium 在 Visual Studio 中编写了一个简单的测试。但是,我试图在多个浏览器上运行相同的测试,但我不断收到相同的错误,即在目录或 PATH 环境变量中找不到驱动程序。 我已经下载了它们,它们在我正在处理的项目中。我一直在尝试所有我发现的不同方法,但没有任何效果。 有人能帮忙吗?谢谢:)
这是代码的sn-p:
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
namespace SeleniumTest2
{
//1 test multiple browsers
[TestFixture(typeof(ChromeDriver))]
[TestFixture(typeof(FirefoxDriver))]
[TestFixture(typeof(InternetExplorerDriver))]
public class ClickTestMetaLearning3TestUser<TWebDriver> where TWebDriver : IWebDriver, new()
{
private IWebDriver driver;
private StringBuilder verificationErrors;
private string baseURL;
private bool acceptNextAlert = true;
[SetUp]
public void SetupTest()
{
this.driver = new TWebDriver();
//Runtime.getRuntime().exec("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255");
baseURL = "http://url";
verificationErrors = new StringBuilder();
}
【问题讨论】:
-
已经为 IE 驱动程序提供了一个线程 - stackoverflow.com/questions/11010317/… 。更多信息可以在这里找到 - qaautomation.net/?p=373
标签: c# selenium selenium-chromedriver