执行正常测试用例时 selenium webDriver 出错

Error in selenium webDriver while executing the normal test case

这是我的 selenium webDriver 代码

package com.pack;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class GoogleSearchTest {
public static void main(String...args) {

        WebDriver driver  = new FirefoxDriver();
        driver.navigate().to("http://google.com");
        String appTitle = driver.getTitle();
        System.out.println("Application title is :: "+appTitle);
        driver.quit();

}
}

以下是我遇到的错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    WebDriver cannot be resolved to a type
    FirefoxDriver cannot be resolved to a type

    at com.pack.GoogleSearchTest.main(GoogleSearchTest.java:9)

我需要了解为什么会出现该错误。

看起来您正在尝试 运行 已经存在编译问题的代码。您应该会看到一个名为 "Problems" 的选项卡,其中显示所有/任何可能的错误和警告。您在该选项卡中看到任何内容吗?如果是这样,它将逐步完成您需要遵循的步骤来解决该问题。

另一种选择是下载新的 eclipse IDE 并配置您的 selenium。让我知道哪一个对你有用。