Sendkeys target

I am trying to automate the press of a down arrow, followed by a press of the Enter key, in order to select the first option on a drop menu. If I put the (already open) drop menu button as the target for the down arrow sendkeys command, it apparently does nothing, but shows as executed. It then timesout when trying to find the first menu option. What am I doing wrong?

It is unclear to me why specifying a target for sendkeys is necessary in any case – I just want the key presses simulated. Equally unclear is why no keypress is recorded when I try recording the macro.

Good question:

  • the normal Selenium sendkeys needs a target because it does not send real keystrokes, instead it sends Javascript events to a certain element (= the one defined by the target). Often this works, but on more complex websites this can fail.

  • the new XType command is a real sendkeys command that works on the operating system level. It does not need a target. But it requires the Kantu RealUser XModule to be installed.

1 Like