我一直在尝试让我的网格与IE一起工作,但在某些时候,我需要指定我的驱动程序的exe的完整路径。
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
DesiredCapabilities ieCapability = DesiredCapabilities.InternetExplorer();
ieCapability.SetCapability(ieOptions.EnsureCleanSession.ToString(), true);
ieCapability.SetCapability(ieOptions.BrowserCommandLineArguments.ToString(), "-private");
我需要知道这是否可以通过InternetExplorerOptions
或DesiredCapabilities
来完成,或者我是否应该创建一个环境变量来保存我的IE驱动程序的路径。
谢谢!
我在使用Selenium时看到的最常见的做法之一是,测试人员将他们的语句放在他们的超类中。
考虑以下内容(我是Java程序员,所以这将是Java代码,您可以转换为c#):
public class SuperTest {
public SuperTest() {
System.setProperty("webdriver.ie.driver", "C:\Path\To\IEDriver.exe");
}
}
public class Test extends SuperTest {}
您可以在Getting started with Selenium framework(还是Java)中看到如何做到这一点。