Micro Focus QTP (UFT) Forums
Deleting portion of URL using QTP and Appending to Existing URL - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Deleting portion of URL using QTP and Appending to Existing URL (/Thread-Deleting-portion-of-URL-using-QTP-and-Appending-to-Existing-URL)



Deleting portion of URL using QTP and Appending to Existing URL - FRashid - 12-11-2009

Hi ,

I have a query and would like to have your suggestions :

I am opening a Browser and navigating to my desired URL in which I provide the login credentials to proceed further .

Next I need to delete a portion of my existing URL (only portion of URL , not whole) and append to the remaining URL through QTP Scripting in order to perform other steps .I can't use Trim function because i don't have to deal with space here .

Any idea on deleting a portion of existing URL and adding a portion to it using QTP Scripting .

Regards,
Faisal Rashid


RE: Deleting portion of URL using QTP and Appending to Existing URL - Saket - 12-11-2009

Get the Current page url
take out the portion of url you want to remain
and then append your desired url portion in it.

I have tried to do this in form browser itself, see the code below
Code:
sPageUrl = Browser("Deleting portion of URL").Page("Deleting portion of URL").GetROProperty("url")
sMainUrl = Mid(sPageUrl,1,instrrev(sPageUrl,"/"))
sMainUrl = sMainUrl & "storing-data-in-excel-sheet-t-2828.html"
Browser("Deleting portion of URL").Navigate sMainUrl