Testing links

Class library usage, coding and language questions.
anzacthecat
Posts: 31
Joined: Mon Jan 10, 2011 1:05 pm

Testing links

Post by anzacthecat » Tue Mar 01, 2011 11:30 am

I have a webpage which contains a number of links.For each one, I want to click on the link which opens a new window. I then want to check that an appropriate page shows (report screenshot) and close the window before clicking on the next link on the original page. The question is, how do I identify the new window that opens so that I can screenshot it and close it?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Testing links

Post by Support Team » Tue Mar 01, 2011 1:03 pm

Hi,

you can iterate thru your tabPages via a foreach statement.
In this statement you can click on the tab, make a screenshot and close the specified tab.
The code should look something like this:
IList<Ranorex.TabPage> tabPageList = repo.IE.Self.Find<Ranorex.TabPage>("./Path/to/your/tabpage");
foreach (Ranorex.TabPage tab in tabPageList)
{
	tab.Click();
	Report.Screenshot();
	Keyboard.Press("{LControlKey down}{Wkey}{LControlKey up}");
}
Regards,
Tobias
Support Team