C# redirect to another page

Ranorex Studio, Spy, Recorder, and Driver.
njansen
Posts: 9
Joined: Thu Nov 20, 2014 10:38 am

C# redirect to another page

Post by njansen » Thu Apr 07, 2016 11:37 am

Hello,

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: C# redirect to another page

Post by odklizec » Thu Apr 07, 2016 12:11 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

njansen
Posts: 9
Joined: Thu Nov 20, 2014 10:38 am

Re: C# redirect to another page

Post by njansen » Tue Apr 12, 2016 11:07 am

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: C# redirect to another page

Post by odklizec » Tue Apr 12, 2016 11:25 am

Hi,

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

Code: Select all

repo.DOMElement.Self.Navigate("url");
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

njansen
Posts: 9
Joined: Thu Nov 20, 2014 10:38 am

Re: C# redirect to another page

Post by njansen » Tue Apr 12, 2016 12:32 pm

Hi,

There's no DOMElement in repo.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: C# redirect to another page

Post by odklizec » Tue Apr 12, 2016 12:38 pm

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).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

njansen
Posts: 9
Joined: Thu Nov 20, 2014 10:38 am

Re: C# redirect to another page

Post by njansen » Tue Apr 12, 2016 1:02 pm

Can you post a sample how to get this dom element?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: C# redirect to another page

Post by odklizec » Tue Apr 12, 2016 1:15 pm

Just add a new element to repository, with @domain attribute (domain name of your main page). Something like this:
dom_example.png
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

njansen
Posts: 9
Joined: Thu Nov 20, 2014 10:38 am

Re: C# redirect to another page

Post by njansen » Tue Apr 12, 2016 1:47 pm

Problem solved. Thanks for your help!