18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Browser.activeElement() in Java Docs

SadanaSadana Members
edited June 2013 in Sahi - Open Source
From the Java Docs of Sahi I found the following method.

activeElement

public ElementStub activeElement(java.lang.Object... args)
Defines the element in focus.
Usage: browser.activeElement()

Example:
assertEquals("username", browser.activeElement().fetch("id"));
Returns:
a stub representing the element


I tried to use it but it wasn't even recognized. Do you know if it should work? I mean if it's some old feature or a coming feature?

Best Answers

  • Hi Sadana,
    Can you please tell me which version of Sahi OS are you using?
    browser.activeElement() is available in Sahi 4.3 and onwards.
    Please let me know if the upgradation resolves your issue.

    Regards.
  • edited June 2013 Answer ✓
    Hi Sadana,
    Please change your Sahi Version to 4.4 which is the latest released Sahi OS version.
    It should solve the problem for you.

    If you still have any problems using the API, please let me know.

    Regards

Answers

  • Hi Sadana,

    Can you please elaborate what you meant by it wasn't recognized ?

    Please send me the HTML for which your are testing.

    Regards,
    Pratik Shah

  • SadanaSadana Members
    When I'm adding it to my code, I'll get error "The method activeElement() is undefined for the type Browser."
  • SadanaSadana Members
    Unfortunately I wasn't able to find direct information about my Sahi version. Changelog.txt has latest input 19.7.2011 which means I'm using v3.5.
  • This case can be closed. Finally our Techsupport upgraded the version.
This discussion has been closed.