java – webdriver是一个类还是一个接口?
发布时间:2020-12-15 04:29:47 所属栏目:Java 来源:网络整理
导读:从 Selenium docs开始,WebDriver是一个接口,但在Eclipse中,org.openqa.selenium包在Project Explorer中显示为Class.此外,如果WebDriver是一个接口,那么实现它的ChromeDriver或InternetExplorerDriver等类应该定义.get()或.getCurrentUrl()等方法.我们在哪里
从
Selenium docs开始,WebDriver是一个接口,但在Eclipse中,org.openqa.selenium包在Project Explorer中显示为Class.此外,如果WebDriver是一个接口,那么实现它的ChromeDriver或InternetExplorerDriver等类应该定义.get()或.getCurrentUrl()等方法.我们在哪里可以看到这些方法的方法定义?
解决方法
WebDriver是一个公共界面,我不认为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 */ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容