类型不匹配:无法使用Java在Selenium Webdriver中从ChromeDriver转换为WebDriver

时间:2019-05-06 07:28:40

标签: java selenium selenium-webdriver

我正在尝试这段代码,但失败了

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

  public class Fijan {

public static void main(String[] args) {
    // TODO Auto-generated method stub

    System.setProperty("webdriver.chrome.driver", "C:Users\\Devrepublic\\Documents\\fijan\\selenium\\chromedriver_win32\\chromedriver");
    WebDriver driver =  new ChromeDriver();
    driver.get("");
    }

线程“主”中的异常java.lang.Error:未解决的编译问题:     类型不匹配:无法从ChromeDriver转换为WebDriver

at prac.Fijan.main(Fijan.java:12)

1 个答案:

答案 0 :(得分:0)

将以下jar添加到buildpath-selenium-java.jar,selenium-remote-driver.jar,selenium-support.jar

Eclipse: How to import a jar in Eclipse

InteliJ Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project