### Question:
TypeTextInElementFoundByCssSelector extends ActionWithJSPreconditionBase { @Override public boolean expectsHttpRequest() { return expectsHttpRequest; } TypeTextInElementFoundByCssSelector(String cssSelector, String text, boolean expectsHttpRequest, SearchContextFunction contextProvider); @Override boolean expectsHttpRequest(); @Override String getJSEventToWaitFor(); @Override void executeAfterJSPreconditionHasBeenSatisfied(WebDriver driver, ReplayingState replayingState, Function<SearchContext, SearchContext> contextProvider);  }### Answer:
@Test public void typesIfSuitableElementExists() { String cssSelector = ".something"; String text = "text"; String eventName = "TypeTextInElementFoundByCssSelector .something text"; boolean expectsHttp = true; WebElement textBox = mock(WebElement.class); WebDriver driver = mock(WebDriver.class); when(driver.findElement(By.cssSelector(cssSelector))).thenReturn(textBox); SearchContextFunction contextProvider = webDriver1 -> driver; WebDriverAction action = new TypeTextInElementFoundByCssSelector(cssSelector, text, expectsHttp, contextProvider); action.execute(driver, mock(ReplayingState.class), mock(EventSynchronizer.class)); verify(textBox).sendKeys(text); assertEquals(eventName, action.getName()); assertEquals(expectsHttp, action.expectsHttpRequest()); }