TangibleDream TangibleDream - 1 year ago 87
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 ""
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download