I want to enter value in a popup text box using groovyscript can some one suggest me how to do that?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to enter value in a popup text box using groovyscript can some one suggest me how to do that?
Hi,
While running groovy script I am getting one pop up text box to enter some values and below that text box i am getting "okay" and "Cancel" button can someone suggest me how to enter value in that pop up text box and click on Okay button using groovy script.
Note: On Right click there is not get data option present
- Labels:
-
SOAP
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Sandeep96 ,
I don't quite follow. You run a Groovy script that presents a modal window and you want to populate that via Groovy script? Have to admit, I have never seen Groovy display a modal window. Can you clarify further and possibly add the script and some screenshots?
Chris
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
with this Groovy script:
import javax.swing.*
def popup = {
JFrame jframe = new JFrame()
String answer = JOptionPane.showInputDialog(jframe, it)
jframe.dispose()
answer
}
def mytext = popup("Enter a text")
log.info "text inserted: " + mytext
I'm able to enter a value in a popup:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Ilario72
Here is a sample that captures the content entered into a prompt from a groovy script. I am not aware of external tools that run against groovy to press buttons for you however. Like ChrisAdams indicated that is a very odd use case and I am just hoping i am misinterpreting the question.
log.info 'Test Step "' + testRunner.runContext.currentStep.name + '" start...';
log.info "";
def testcaseNameFilePath = 'C:\\Temp\\FHIR MolecularSequence Testcase Files\\';
def titleStr = 'Prompt';
def questionStr = 'Path of input testcase name files? ';
def valueStr = testcaseNameFilePath;
def fileInput = com.eviware.soapui.support.UISupport.prompt(questionStr, titleStr, valueStr).toString();
assert (fileInput), "Path can not be empty";
log.info "fileInput response=$fileInput";
//testRunner.testCase.testSteps["Properties"].setPropertyValue( "testcaseNameFilePath", fileInput);
log.info "";
log.info 'Test Step "' + testRunner.runContext.currentStep.name + '" finish...';
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey @Sandeep96
sorry Im a little late in responding as I've been on holiday.
I'm intrigued by this - can I ask:
- what's the purpose of the groovy script? why would a script that halts the execution of the testcase be added?
-after inputting a value into the editable field and selecting 'OK' to submit the value, how is this value being used later in the script?
- the groovy script test step in the image you provide - is there further groovy in the step or is what is displayed in the image the entirety?
-if the value is used by other steps in your testcase, would it not increase efficiency/automation by finding another means of providing this value - i..e then allowing you to remove the groovy step completely?
Cheers,
Rich
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think @Sandeep96 answered his own question.
I think the requirement was... "Using Groovy script, how do I display a pop-up/modal window; let the user input text; capture the answer in a variable?".
