WebDriver user interactions issue…solved!

18 Jan

I ran into a snag with an exercise from the Udemy site for Selenium involving user actions.  The ‘Actions’ class in Selenium lets the automation model the behavior of a user sitting at the keyboard to type things in, click, drag and so on.  Fine.  What was occurring with firefox was, when the browser came up and the ‘user’ started typing, the typing went into the address bar of the browser instead of the browser page itself.  At the time I was trying to type ‘ctrl-b’ to prompt a change in one of the page elements, but this wasn’t occurring.

I knew I had to get that page in focus, but was not having success doing so.  Finally, after a bit of searching on the web, I came across a solution that works and is very simple.

Before entering any text using the Actions object, perform the following:


That’s it.  That code performs a simple click on the background of the base html page which changes the focus appropriately.  From that point on, my Actions code worked like a charm.


2 Responses to “WebDriver user interactions issue…solved!”

  1. alanjrichardson March 4, 2013 at 7:52 am #

    Thanks Kent, I didn’t need this in earlier versions of Firefox, but I do now.

    I’ll update my course code accordingly



  1. Click on “html” to make User Interactions more reliable » Selenium Simplified - March 17, 2017

    […] WebDriver user interactions issue…solved! […]

Comments are welcome!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: