Micro Focus QTP (UFT) Forums

Full Version: Deleting portion of URL using QTP and Appending to Existing URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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