RikSaunderson
RikSaunderson

Reputation: 3765

Selenium: How do I get the locator of the element which currently holds the cursor?

I'm writing an auto testing framework using Selenium. I am trying to test our application which interacts with a third party web application. I don't have access to the source code of the web app.

I want to be able to use selenium to put some text in a text box, but no matter how hard I try, selenium IDE isn't able to record me putting text into this box.

Firebug seems to imply that this is because the box that I am trying to write to is with a separate html form imbedded with the page. However, I am able to interact with the web app so that the cursor is in the text box.

Is there a way to either:

a) Input text at the current cursor position (i.e. without referencing a locator because I can't seem to be able to get the locator.)

or,

b) Get the locator of the element which currently holds the cursor?

Thanks in advance, Rik

Upvotes: 0

Views: 761

Answers (1)

Rajasankar
Rajasankar

Reputation: 928

If it is an iframe you need to change the focus to iframe and try to do the actions.

Upvotes: 1

Related Questions