Capture url in C #

Ranorex Studio, Spy, Recorder, and Driver.
Praveen597
Posts: 27
Joined: Sat Aug 27, 2011 9:41 am

Capture url in C #

Post by Praveen597 » Mon Oct 03, 2011 6:57 am

Hi All,

I want to capture URL of the current web page using C # code in Ranorex.

Can any one please help me out...?

I am trying to use this piece of code

string url = HttpContext.Current.Request.Url.AbsoluteUri;


But no use.

Thanks,
Praveen.

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: Capture url in C #

Post by sdaly » Mon Oct 03, 2011 8:15 am

You need to first of all find the dom, then you can access the page url -

Code: Select all

Ranorex.Webdocument dom = "/dom[@domain~'ranorex']";

string pageurl = dom.PageUrl;

Praveen597
Posts: 27
Joined: Sat Aug 27, 2011 9:41 am

Re: Capture url in C #

Post by Praveen597 » Wed Oct 05, 2011 12:05 pm

Thanks. It is working.