Java 类org.openqa.selenium.support.events.AbstractWebDriverEventListener 实例源码

项目:de.lgohlke.selenium-webdriver    文件:DriverServiceTest.java   
@Test
@SuppressWarnings("unchecked")
public void shouldBeWrappedInEventFiringWebdriver() throws Throwable {
    AbstractWebDriverEventListener eventListener = new AbstractWebDriverEventListener() {
    };
    driverService = new DriverService(DriverType.PHANTOMJS, eventListener);

    driverService.before();

    WebDriver driver = driverService.getDriver();
    assertThat(driver).isInstanceOf(EventFiringWebDriver.class);

    EventFiringWebDriver eventFiringWebDriver = (EventFiringWebDriver) driver;
    Field                field                = EventFiringWebDriver.class.getDeclaredField("eventListeners");
    field.setAccessible(true);

    assertThat(((List<WebDriverEventListener>) field.get(eventFiringWebDriver)).size()).isEqualTo(1);
}