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.

Emulating tab key press or 'enter' keypress event, for list item ..

cmani87cmani87 Members
edited November -1 in Sahi - Open Source
I want to complete selection of a list item...

I had used, _setValue(_textbox("textid1"), "test");

to set a value....But, when I move to the next field using click or something, the value is getting set to 'blank', instead of 'test'...

And I tried with keyPress event, with char as [13,13] for enter key...

But, the textbox is setting value to 'null'(not blank)...Is there a way to simulate, 'enter' keypress, after a list item is selected, to set the value...

Or, is there a way to simulate tab key press, through javascript? (as I had checked with earlier posts, tab key press could be simulated through javascript..how will that look?)

Thanks,

Mani

Comments

  • cmani87cmani87 Members
    I gave the below code and it worked for setting a value to the combo box...

    _setValue(_textbox("testid1"), "Reduction");
    _wait(5000);
    _keyPress(_textbox("testid1"), [13,13]);
    _wait(5000);

    The problem is like, when i give, Pre-Reduction, the value in textbox("testid1") is setting to blank
    _setValue(_textbox("testid2"), "Pre-Reduction");
    _wait(5000);
    _keyPress(_textbox("testid2"), [13,13]);
    _wait(5000);

    Pre-Reduction value is there as such in the combo box, unless and until, I setValue for some other combo box...Not sure, why it happens!
  • Hi,

    I am currently facing the same issue.Was a resolution proposed? If so I would be very grateful if you could let me know.

    Many thanks in advance.
  • Hi swetha and cmani,
    You can simulate ENTER key press event in an alternate way (using _typeKeyCodeNative function) which has been shown in an example in the following page:
    http://sahi.co.in/w/_setFile
    

    Please let me know if you have problems with the mentioned way.

    Regards.
Sign In or Register to comment.