TangibleDream TangibleDream - 8 months ago 51
Ruby Question

How do I set focus on an anchor?

I'm trying to activate a link by setting focus to it and sending an enter key.

example = find{:xpath,'//*[@id="whatever"]/div/a')

What am I missing?

Answer Source

Send an empty key to the element, so it gets focused.

example.send_keys ""