Selenium WebDriver is a class or interface?

The best way to answer this question is to check the source code of Selenium WebDriver. The source code can be found here.

In that source code it is clearly mentioned that, the Selenium WebDriver is an interface. The clear and concise source code of selenium WebDriver interface is mentioned below:-

import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.logging.Logs;

import java.net.URL;
import java.time.Duration;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

public interface WebDriver extends SearchContext {

	void get(String url);

	String getCurrentUrl();

	String getTitle();

	@Override
	 findElements(By by);

	@Override
	WebElement findElement(By by);

	String getPageSource();

	void close();

	void quit();

	 getAvailableEngines();

		String getActiveEngine();

		boolean isActivated();

		void deactivate();

		void activateEngine(String engine);
	}

	@Beta
	interface Window {

		Dimension getSize();

		void setSize(Dimension targetSize);

		Point getPosition();

		void setPosition(Point targetPosition);

		void maximize();

		void minimize();

		void fullscreen();
	}
}

So, as mentioned above, it contains many abstract methods and also the nested interfaces. And RemoteWebDriver.java class implements this WebDriver interface.

For more questions related to Selenium WebDriver please visit here.

1 Reply to “Selenium WebDriver is a class or interface?”

Comments are closed.