Class EdgeHtmlDriver

  • All Implemented Interfaces:
    org.openqa.selenium.HasCapabilities, org.openqa.selenium.interactions.HasInputDevices, org.openqa.selenium.interactions.Interactive, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator, org.openqa.selenium.WebDriver

    public class EdgeHtmlDriver
    extends org.openqa.selenium.remote.RemoteWebDriver
    A WebDriver 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 a RemoteWebDriver coupled with the desired EdgeHtmlDriverService, 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.edgehtml.EdgeHtmlDriverService;
     import org.openqa.selenium.edgehtml.EdgeHtmlOptions;
     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 EdgeHtmlTest {
    
         private static EdgeHtmlDriverService service;
         private WebDriver driver;
    
         {@Literal @BeforeAll}
         public static void createAndStartService() {
             EdgeHtmlDriverService.Builder builder = new EdgeHtmlDriverService.Builder();
             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 EdgeHtmlOptions());
         }
    
         {@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.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
    • Method Summary

      • Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver

        addVirtualAuthenticator, builder, close, execute, execute, execute, executeAsyncScript, executeScript, findElement, findElement, findElements, findElements, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getExecuteMethod, getFileDetector, getKeyboard, getMouse, getPageSource, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, perform, quit, removeVirtualAuthenticator, resetInputState, setCommandExecutor, setElementConverter, setErrorHandler, setFileDetector, setFoundBy, setLogLevel, setSessionId, startSession, switchTo, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.openqa.selenium.JavascriptExecutor

        executeScript, getPinnedScripts, pin, unpin