How to save part of the URL?


I would like to save in a variable part of URL. How can I do it?
I have a code which returns what I need, but how can I save this return?

If you want to save in a variable for later usage then you can set up an “equate” statement, like below. The return value in this case would be the variable “result”. After the “equate” statement, which should be a String, you can use the variable to display, or save, the information you want.

def result = methodToGetUrlPart(...)
WebUI.comment("the URL part is ${result}")
println("the URL part is ${result}")

Just a note that your “code which returns what [you] need” has to have a “return data type” of String for this to work.