Ans:-
This is very frequently asked by the interviewer to check whether you are aware about the JavaScriptExecutor interface or not. Using javaScriptExecutor we can enter the input data in a text box. The code is mentioned below:-
Code:-

Explanation of the source code (Here source code snip added for better understanding):-
JavaScriptExecutor is an interface .

WebDriver also is an interface.

RemoteWebDriver implements these two interfaces. RemoteWebDriver is a class. RemoteWebDriver actually implementing lots of interfaces.

ChromeDriver also is a class which extends the RemoteWebDriver.

Casting of driver class:-

Here we have created the instance of the interface but we are casting the driver object using the JavascriptExecutor interface so that we can use the executeScript method.