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.

Know name of component

MujhahidMujhahid Members
edited November -1 in Sahi - Open Source
Good afternoon

Based on this example that the site, about using SAHI with Java:

browser.textbox("q").setValue("sahi forums");

How do I know the field name, "q " without going to see in the browser> pageSorce

Some function for it to return the field name or the "q".

Regards

Comments

  • SumitraSumitra Members
    Hi Mujhahid,

    Using java Controller you can get the alternate accessors of an element.

    Here are the instructions to configure Sahi to use java controller,

    1) Edit Sahi.properties located inside sahi/config directory as

    controller.mode=java

    instead of

    controller.mode=Sahi

    2) Restart Sahi.

    3) On your testing page, press alt and double click to bring up the java controller.

    4) Hover the mouse over the element.

    5) You can get all the accessors of an element in the Alternatives drop down box in java controller.

    There are no such api's for finding all fieldname's of an element.

    Regards
    Sumitra
  • MujhahidMujhahid Members
    Thanks for the reply Sumitra,

    So we can say that google will always have access to the search textbox named "q", never changes? or who changes?

    Regards
  • SumitraSumitra Members
    Hi Mujhahid,

    Sahi provides an Accessor Spy to help you identify elements on any web page.

    For eg:

    If you have 3 textbox, Sahi’s accessor spy will identify them by indexes (_textbox("q"), _textbox("q[1]") and _textbox("q[2]")).


    Regards
    Sumitra
  • MujhahidMujhahid Members
    Good night, for example to google.com, I can not figure out the element, ie step 4 above I can not run successfully, it could explain how to know the name of the component through the controller SAHI, since the API does not provides a method for this.

    Regards
  • MujhahidMujhahid Members
    Sumitra, sorry already realized, you very well you planned, but one doubts that just like to clarify:

    google.com in the textbox is called "q":

    1. One day the variable "q", will be able to change?

    2. Who changes, are people who develop google?

    or variable "q" the browser that assigns

    Regards
Sign In or Register to comment.