cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy Script in Virt to generate html page with a button on it.

New Contributor

Groovy Script in Virt to generate html page with a button on it.

Hi,

 

I am new to ReadyAPI Service Pro. Need my Virt to generate an html page which has a button on it. On click it should be navigating to a link saved in a csv file.

 

I believe it needs a piece of Groovy code which embeds html into it. Can anyone please help?

1 REPLY 1
Moderator

Re: Groovy Script in Virt to generate html page with a button on it.

Hi Aradhna,

 

Thank you for your post. To create an HTML page as a response in ServiceV, you need to select the text/html as the Content | Media Type value. The below HTML can be used to create a page with a button and link:

<html>
<input type="button" value="Link" onclick="window.location.href='https://www.smartbear.com/'" />
</html>

Please see the sample screenshot:

Jing_2018-09-12_19-31-29.png

 

Please see the following article about scripting in ServiceV: Virtual Service Scripting.

Also, here is the article about reading from an Excel file which also could help you: 

Example of using third-party Java libraries in Groovy script: reading from Excel file using Apache P...

 


Anastasia
Customer Care Team


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

New Here?
Join us and watch the welcome video:
Top Kudoed Authors