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.

Choose an item of a combobox

carlospmcarlospm Members
edited November -1 in Sahi - Open Source
Hi,
How can I choose an item of a combobox? Because the instruction which catch Sahi is

_click(_div("x-combo-list-item x-combo-selected"));

and the element chosen is the first on the list. How can I do to choose another item?

Regards

Comments

  • use _setSelected(element, option_identifier[, isMultiple]) click not apply.

    Ej:

    _setSelected(_select("Age"), "28");
    _setSelected(_select("color"), 1); // Selects the second option in a select box
    _setSelected(_select("color"), red); // Selects red in a multiselect box
    _setSelected(_select("color"), blue, true); // Selects blue also in the multiselect box
  • Thanks for your reply

    I have a problem in the part _select("color")
    because i am testing with some different options but it doesn't work
    Can you give an idea of how can I put in that place?

    Thanks
  • _select ("color") is the name of the control. In this case the combobox. You identify this name from the controller.

    Note that the value of the combo you select must be the same as shown in the application.

    is not the same the letter "a" to the letter "A"

    for example if the combo has the word

    "Colombia", because not put "colombia"

    example:

    _setSelected (_select ("Country"), "Colombia"); ok
    _setSelected (_select ("Country"), "colombia"); Error
  • Thank you very much

    It was difficult to find out the control

    Bye
Sign In or Register to comment.