webdriver 是 class 还是接口?

Is webdriver a class or a interface?

Selenium docs 开始,WebDriver 是一个接口,但在 Eclipse 中,包 org.openqa.selenium 在 Project Explorer 中显示为 Class。另外,如果 WebDriver 是一个接口,那么实现它的 类 像 ChromeDriver 或 InternetExplorerDriver 应该定义像 .get().getCurrentUrl() 这样的方法。在哪里可以看到这些方法的方法定义呢?

WebDriver 是一个 public 接口,我认为 ChromeDriver 或任何其他驱动程序都没有实现 WebDriver,他们宁愿扩展 RemoteWebDriver,这是一个 class。

编辑

正如我所说的,驱动程序扩展了 RemoteWebDriver 并且具有这些方法的实际实现..

public void get(String url) {
   execute(DriverCommand.GET, ImmutableMap.of("url", url));
}

Java 来源:

public interface WebDriver extends SearchContext {
  // Navigation

  /**
   * Load a new web page in the current browser window. This is done using an HTTP GET operation,
   * and the method will block until the load is complete. This will follow redirects issued either
   * by the server or as a meta-redirect from within the returned HTML. Should a meta-redirect
   * "rest" for any duration of time, it is best to wait until this timeout is over, since should
   * the underlying page change whilst your test is executing the results of future calls against
   * this interface will be against the freshly loaded page. Synonym for
   * {@link org.openqa.selenium.WebDriver.Navigation#to(String)}.
   *
   * @param url The URL to load. It is best to use a fully qualified URL
   */

WebDriver是一个public接口,我们只是定义一个类型为interface的引用变量(driver)。现在我们分配给它的任何对象都必须是实现该接口的 class (fireFoxDriver) 的实例。