gpt4 book ai didi

java - webdriver 是类还是接口(interface)?

转载 作者:搜寻专家 更新时间:2023-11-01 01:50:53 25 4
gpt4 key购买 nike

来自Selenium docs ,WebDriver 是一个接口(interface),但在 Eclipse 中,包 org.openqa.selenium 在 Project Explorer 中显示为一个类。此外,如果 WebDriver 是一个接口(interface),则实现它的 ChromeDriver 或 InternetExplorerDriver 等类应该定义 .get().getCurrentUrl() 等方法。在哪里可以看到这些方法的方法定义呢?

最佳答案

WebDriver 是一个公共(public)接口(interface),我不认为 ChromeDriver 或任何其他驱动程序实现了 WebDriver,他们宁愿扩展 RemoteWebDriver 这是一个类。

编辑

正如我所说的,驱动程序扩展了 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
*/

关于java - webdriver 是类还是接口(interface)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32670288/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com