有人可以帮我解决这个问题。当我在 TestNG 中运行以下代码时,出现以下错误:“驱动程序可执行文件的路径必须由 webdriver.ie.driver 系统属性设置;”
public class GoogleSearch2 {
RemoteWebDriver driver;
DesiredCapabilities cap;
@Test(dataProvider="getData")
public void searchTest2() throws MalformedURLException{
System.out.println(browser);
if(browser.equals("firefox")){
System.setProperty("webdriver.firefox.bin", "C:\\Users\\sqadri \\Mozilla
Firefox\\firefox.exe");
cap = DesiredCapabilities.firefox();
cap.setBrowserName("firefox");
cap.setPlatform(Platform.ANY);
}
else if(browser.equals("iexplore")){
File file = new File("D:/Data/IEDriver/IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
cap = DesiredCapabilities.internetExplorer();
cap.setBrowserName("iexplore");
cap.setPlatform(Platform.WINDOWS);
}