Package org.openqa.selenium.edge
Class EdgeDriver
- java.lang.Object
-
- org.openqa.selenium.remote.RemoteWebDriver
-
- org.openqa.selenium.chromium.ChromiumDriver
-
- org.openqa.selenium.edge.EdgeDriver
-
- All Implemented Interfaces:
org.openqa.selenium.devtools.HasDevTools
,org.openqa.selenium.HasCapabilities
,org.openqa.selenium.html5.LocationContext
,org.openqa.selenium.html5.WebStorage
,org.openqa.selenium.interactions.HasInputDevices
,org.openqa.selenium.interactions.HasTouchScreen
,org.openqa.selenium.interactions.Interactive
,org.openqa.selenium.internal.FindsByClassName
,org.openqa.selenium.internal.FindsByCssSelector
,org.openqa.selenium.internal.FindsById
,org.openqa.selenium.internal.FindsByLinkText
,org.openqa.selenium.internal.FindsByName
,org.openqa.selenium.internal.FindsByTagName
,org.openqa.selenium.internal.FindsByXPath
,org.openqa.selenium.JavascriptExecutor
,org.openqa.selenium.mobile.NetworkConnection
,org.openqa.selenium.SearchContext
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.WebDriver
public class EdgeDriver extends org.openqa.selenium.chromium.ChromiumDriver
AWebDriver
implementation that controls an Edge browser running on the local machine. This class is provided as a convenience for easily testing the Edge browser. The control server which each instance communicates with will live and die with the instance. To avoid unnecessarily restarting the Microsoft WebDriver server with each instance, use aRemoteWebDriver
coupled with the desiredEdgeDriverService
, which is managed separately. For example:import org.junit.jupiter.api.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.WebElement; import org.openqa.selenium.edge.EdgeDriverService; import org.openqa.selenium.edge.EdgeOptions; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.remote.service.DriverService; import java.io.IOException; import java.util.ServiceLoader; import java.util.stream.StreamSupport; import static org.junit.jupiter.api.Assertions.assertEquals; public class EdgeTest { private static EdgeDriverService service; private WebDriver driver; {@Literal @BeforeAll} public static void createAndStartService() { // Setting this property to false in order to launch Chromium Edge // Otherwise, old Edge will be launched by default System.setProperty("webdriver.edge.edgehtml", "false"); EdgeDriverService.Builder<?, ?> builder = StreamSupport.stream(ServiceLoader.load(DriverService.Builder.class).spliterator(), false) .filter(b -> b instanceof EdgeDriverService.Builder) .map(b -> (EdgeDriverService.Builder) b) .filter(b -> b.isLegacy() == Boolean.getBoolean("webdriver.edge.edgehtml")) .findFirst().orElseThrow(WebDriverException::new); service = builder.build(); try { service.start(); } catch (IOException e) { throw new RuntimeException(e); } } {@Literal @AfterAll} public static void createAndStopService() { service.stop(); } {@Literal @BeforeEach} public void createDriver() { driver = new RemoteWebDriver(service.getUrl(), new EdgeOptions()); } {@Literal @AfterEach} public void quitDriver() { driver.quit(); } {@Literal @Test} public void testBingSearch() { driver.get("http://www.bing.com"); WebElement searchBox = driver.findElement(By.name("q")); searchBox.sendKeys("webdriver"); searchBox.submit(); assertEquals("webdriver - Bing", driver.getTitle()); } }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openqa.selenium.remote.RemoteWebDriver
org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator, org.openqa.selenium.remote.RemoteWebDriver.RemoteWebDriverOptions, org.openqa.selenium.remote.RemoteWebDriver.When
-
Nested classes/interfaces inherited from interface org.openqa.selenium.mobile.NetworkConnection
org.openqa.selenium.mobile.NetworkConnection.ConnectionType
-
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
org.openqa.selenium.WebDriver.ImeHandler, org.openqa.selenium.WebDriver.Navigation, org.openqa.selenium.WebDriver.Options, org.openqa.selenium.WebDriver.TargetLocator, org.openqa.selenium.WebDriver.Timeouts, org.openqa.selenium.WebDriver.Window
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DRIVER_USE_EDGE_EDGEHTML
Boolean system property that defines whether the msedgedriver executable (Chromium Edge) should be used.
-
Constructor Summary
Constructors Constructor Description EdgeDriver()
EdgeDriver(org.openqa.selenium.Capabilities capabilities)
Deprecated.EdgeDriver(EdgeOptions options)
-
Method Summary
-
Methods inherited from class org.openqa.selenium.chromium.ChromiumDriver
executeCdpCommand, getCastIssueMessage, getCastSinks, getDevTools, getLocalStorage, getNetworkConnection, getSessionStorage, getTouch, launchApp, location, quit, selectCastSink, setFileDetector, setLocation, setNetworkConnection, setPermission, startTabMirroring, stopCasting
-
Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver
builder, close, execute, execute, executeAsyncScript, executeScript, findElement, findElement, findElementByClassName, findElementByCssSelector, findElementById, findElementByLinkText, findElementByName, findElementByPartialLinkText, findElementByTagName, findElementByXPath, findElements, findElements, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getExecuteMethod, getFileDetector, getKeyboard, getMouse, getPageSource, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, perform, resetInputState, setCommandExecutor, setElementConverter, setErrorHandler, setFoundBy, setLogLevel, setSessionId, startSession, switchTo, toString
-
-
-
-
Field Detail
-
DRIVER_USE_EDGE_EDGEHTML
public static final java.lang.String DRIVER_USE_EDGE_EDGEHTML
Boolean system property that defines whether the msedgedriver executable (Chromium Edge) should be used.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EdgeDriver
public EdgeDriver()
-
EdgeDriver
public EdgeDriver(EdgeOptions options)
-
EdgeDriver
@Deprecated public EdgeDriver(org.openqa.selenium.Capabilities capabilities)
Deprecated.
-
-