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.

Question regarding the combo of auto populate field followed by a drop down list?

sahirookiesahirookie Members
edited May 2014 in Sahi Pro
Hi,
I'm a new user of the Sahi tool (using Sahi Pro 5.0.9 (2013-08-26), Mozilla Firefox 29.0.1), and so far found it easy to use except for this one issue which i am unable to get a solution for. I have a webpage with a field input to select the city ,which works like this; on typing the first letter(s), a drop down list with the possible selection values are displayed.It requires a mouse click to get the required value from the dropdown list to populate on to the field.

My problem, when i playback on Sahi, I tried using the _setValue(_textbox("city"),"NY") as well as tried with the _setSelected(_select("city"), "NY") to set the value in the field. But the webpage doesnt recognise the value set in the field unless it is selected using the mouse click from the dropdown list and ends as failure since the script cant proceed further, How do i resolve this?

Best Answer

  • Answer ✓
    Try this


    Instead of _mouseDown, use "_mouseOver" and _click with Alternatives like "_listItem(link(9)) "

Answers

  • globalwormingglobalworming Moderators
    cant test it right now, but try something like

    _setValue() on the input
    _focus() on the input

    there was a case where the _focus() API would help
  • Hi,

    Thank you for the response.

    I tried with the _focus(), it too didnt work. Some more info on the same, it seems the particular field is using Ajax framework to retrieve the data from the dropdown list. However here on setting the data value in the field, the dropdown box is not displayed (or opened up) during the playback. Why is this so, any idea? I also tried using _listItem() to get the values, but since the dropdown list doesnt open up, i think it doesnt work here.

    i have tried using the following functions in many combinations for the same:

    _click(_textbox("cityState"));

    _setValue(_textbox("cityState"),"Neal, Kansas, 66863");

    _setselected(_textbox("cityState"),"Neal, Kansas, 66863");

    _focus(_textbox("cityState"));

    _mouseDown(_listItem("N Syracuse, New York, 13212"),true)

    _click(_listItem("Neal, Kansas, 66863"))

    _keyPress(_textbox("cityState"), 'Neal, Kansas, 66863')


    _keyDown(_textbox("cityState"),[Neal, Kansas, 66863])

    Running out of ideas..! Any help would be appreciated.
  • Hi Arun,

    Thanks for the suggestion.It worked!!
Sign In or Register to comment.