What is the way to send text input to a focused element?

904    Asked by MilanModlin in QA Testing , Asked on Feb 4, 2020
Answered by Milan Modlin

To send a content contribution to the focused component, reproduce key pushes on the engaged component. The principal path is to execute "actions" on the web driver object. Command to achieve:

new Actions(webDriver).sendKeys(“sample test”).perform();

Another decision is to change to the dynamic component and send text input to it straightforwardly. Command to achieve:

webDriver.switchTo().activeElement().sendKeys(“sample test”);



Your Answer

Interviews

Parent Categories