Page 1 of 1

C# redirect to another page

Posted: Thu Apr 07, 2016 11:37 am
by njansen
Hello,

I want to redirect to another page using a code module.
I can't use Response.Redirect, how should solve this issue?

Re: C# redirect to another page

Posted: Thu Apr 07, 2016 12:11 pm
by odklizec
Hi,

I'm afraid, there is not enough information regarding your problem. Redirect to WHAT kind of page? HTML page, desktop app page, mobile app page,...?
What kind of technology is your AUT?
What's your Ranorex version?
Could you please post a Ranorex snapshot (not screenshot) of the page in question?

You see, it's impossible to help you without further details.

Re: C# redirect to another page

Posted: Tue Apr 12, 2016 11:07 am
by njansen
I want to redirect to a aspx page within the same browser window (desktop pc, internet explorer),
I'm using Ranorex version 5.3.1.22939

Re: C# redirect to another page

Posted: Tue Apr 12, 2016 11:25 am
by odklizec
Hi,

Try InvokeAction.Navigate(string url) function. Basically, it should look like this:

Code: Select all

repo.DOMElement.Self.Navigate("url");

Re: C# redirect to another page

Posted: Tue Apr 12, 2016 12:32 pm
by njansen
Hi,

There's no DOMElement in repo.

Re: C# redirect to another page

Posted: Tue Apr 12, 2016 12:38 pm
by odklizec
DOMElement used in my example is just a dummy element used for illustration ;) You should replace it with your DOM element (topmost element for given domain).

Re: C# redirect to another page

Posted: Tue Apr 12, 2016 1:02 pm
by njansen
Can you post a sample how to get this dom element?

Re: C# redirect to another page

Posted: Tue Apr 12, 2016 1:15 pm
by odklizec
Just add a new element to repository, with @domain attribute (domain name of your main page). Something like this:
dom_example.png

Re: C# redirect to another page

Posted: Tue Apr 12, 2016 1:47 pm
by njansen
Problem solved. Thanks for your help!