How to get link on page and reuse it in the next test case?

I am trying to test the ‘Forgot Password’ functionality and here’s what I need to do:
1. In the mailbox, I need to get the URL specified in the email.
2. Go to the next test case and access that particular URL pulled from the email.

Can I get the URL value and store it somewhere and then pull that value again?
Please provide sample code :smiley:
Please help.

Yes absolutely you can by using ‘return’ from one test case and then use it in another test case, example:

TC1:
String url = WebUI.getURL()
return url
TC2:
String url = WebUI.callTestCase(TC1)

Can I do this if the link/URL is somewhere on the webpage?
Example get the link/URL displayed in the email and then open that in another Test Case?

Thanks

custUrl = WebUI.getAttribute(findTestObject(‘Object Repository/QA2_OBP_OR/SettingsInTransactionPage_OR/input_customUrl’), ‘value’)

WebUI.println('custUrl = '+ custUrl)

payerUrl=WebUI.concatenate([baseUrl, custUrl] as String[],

FailureHandling.STOP_ON_FAILURE)

WebUI.println('payerUrl = '+ payerUrl)

WebUI.navigateToUrl(payerUrl)

WebUI.waitForPageLoad(20)

I will try it. Thanks!