我尝试过以下代码
package simple_programs1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class ClassessandObjects {
public static void main(String[] args) {
// TODO Auto-generated method stub System.setProperty("WebDriver.IE.Driver", "E:\\Softwares\\IEDriverServer_x64_2.39.0\\IEDriverServer.exe"); WebDriver driver = new
InternetExplorerDriver();
}
我使用过 IEDriverServer_x64_2.39.0 > IEDriverServer ,当我使用java
代码连接驱动程序时,显示以下错误
类型不匹配:无法将InternetExplorerDriver转换为Web驱动程序。
我在哪里弄错了?
答案 0 :(得分:0)
您没有在任何地方实例化驱动程序。除此之外,您还需要按如下方式设置驱动程序的路径。查看更多here
package simple_programs1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class ClassessandObjects {
public WebDriver driver;
public static void main(String[] args) {
System.setProperty("webdriver.ie.driver", "E:\\Softwares\\IEDriverServer_x64_2.39.0\\IEDriverServer.exe"); WebDriver driver = new
driver = new InternetExplorerDriver();
}