Home > Automation Testing > Use Actions class to perform keyboard event in selenium

Use Actions class to perform keyboard event in selenium

This post was most recently updated on June 14th, 2019

Code to perform key press events , mouse left right operations using action class.

Functions for keyboard Uses
keyDown(java.lang.CharSequence key) To simulate key down event on current location.
keyDown(WebElement target, java.lang.CharSequence key) To simulate key down event on target element.
keyUp(java.lang.CharSequence key) To simulate key up event on current location.
keyUp(WebElement target, java.lang.CharSequence key) To simulate key up event on target element.
sendKeys(WebElement target, java.lang.CharSequence… keys) To simulate send keys on targeted element.
sendKeys(java.lang.CharSequence… keys) To simulate send keys on current location.

 

Code snippet: For key press simulation using different functions available in Action class.

Selenium Tutorial >>

 

This Article is TAGGED in . BOOKMARK THE permalink.

Avatar photo
Neeraj Vishwakarma
Senior QA Engineer Skills: Automation Testing, Manual Testing, STLC, Java, Selenium Webdriver, Protractor, Database Testing.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">