Use Advanced User Interactions in Selenium WebDriver to Drive Keyboard and Mouse

Perform Complex Mouse and Keyboard Operations in Selenium WebDriver

Zhimin Zhan
5 min readJun 5, 2022

--

A repost of my daughter’s article with permission and slight modification. I added it here for the convenience of my blog subscribers. You can find more Selenium examples like this one in my eBook: Selenium WebDriver Recipes in Ruby. This is also included in my “How to in Selenium WebDriver” series.

The ActionBuilder in Selenium WebDriver provides a way to set up and perform complex user interactions. Specifically, grouping a series of keyboard and mouse operations and sending them to the browser.

Mouse interactions

  • click
  • click_and_hold
  • context_click
  • double_click
  • drag_and_drop
  • drag_and_drop_by
  • move_by
  • move_to
  • release

Keyboard interactions

  • key_down
  • key_up
  • send_keys

These functions in Advanced User Interactions are self-explanatory. This article will show some examples of how to use them.

--

--

Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.