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.

How to input values through inputbox

sumit2282sumit2282 Members
edited February 2013 in Sahi - Open Source
Hi
can we have inputbox in sahi .where user input something and this will display in the browser text box.

as i tried the code

var $x = _prompt("Enter value");
_setValue(_textbox("user"), $x);

but i found _sahi.setServerVar('___lastValue___1347895242406'(_setValue(_textbox("user"), null); value

please help me.

thanks
sumit

Answers

  • Hi,

    Please refer the below code to get a prompt.
    // -- Add this to your script: Start --
    <browser>
    function promptForUserInput(){
    	_sahi_temp_promptValue = _sahi._prompt("Enter a name");
    }
    </browser>
    
    function getUserInput(){
    	var $value = null; 
    	_call(promptForUserInput());
    	_set($value, _sahi_temp_promptValue);
    	return $value;
    }
    // -- Add this to your script: End --
    
    
    // Get the user input in your script
    var $userInput = getUserInput();
    _alert($userInput);
    
    


    Regards,
    Pratik Shah
Sign In or Register to comment.