Page 1 of 1

Multiple tabs

Posted: Wed Aug 05, 2009 12:46 pm
by markwhite
I'm doing automated testing with few tabs in Firefox, from left to right. See attached picture.

Working scenario: All tabs have the same name (i.e. INDEX). Under each tab is some action performed without JavaScript, which is disabled. If action under tab if performed well, the Ranorex is working fine and moving to another tab to the right.

Failure scenario: If under some of tabs, in this case third from left the server didn't respond to the action or some error is occurred, the Ranorex is confused and automation stop working. Sometimes the title of tab is changed to different name of error (i.e. ERROR), sometimes not. But if I check it in Firefox History, the name of page is always changed from INDEX to ERROR.

Could you possible know where is the error and how can I fix it?

Is there some option to skip tab where the error is occurred and just move on the next?
Or some solution where after the button submit action under tab, to program Ranorex to not wait for server response, just to move on to next tab?

Re: Multiple tabs

Posted: Wed Aug 05, 2009 2:17 pm
by Support Team
Hi markwhite!

I`m not really sure I understand your issue. But...
to do a better iteration through the firefox tabs use the 'Element.Children' list of the 'TapPageList' from firefox. In this case it`s not necessary to have the right tab title. Further Ranorex doesn`t wait for server response so I think the corresponding element isn`t found. You can set the 'SearchTimeout' for the element if you want to wait for responding. If the element still wasn`t found and you want to step over to the next tap, catch the 'Ranorex.ElementNotFound' exception and continue your iteration.

Furthermore there`s no 100% support for Firefox Browser at the moment but we are currently working on a Firefox plugin.

Regards,
Christian
Support Team

Re: Multiple tabs

Posted: Wed Aug 05, 2009 2:42 pm
by markwhite
Thanks Christian!

You are right, the corresponding element isn't found. I'm already using the 'Element.Children' list of the 'TabPageList' from Firefox and that doesn't solve problem.

Is there available explanation how to catch the 'Ranorex.ElementNotFound' exception and continue?

Re: Multiple tabs

Posted: Wed Aug 05, 2009 3:51 pm
by Support Team
That`s no Ranorex specific question e.g. in C# simply use the 'continue' statement:
foreach(Ranorex.TabPage page in tabPageList.FindChildren<Ranorex.TabPage>())
{
         try
         {
                // your automation
                // e.g. click
                page.Click();
                //..
         }
         catch
         {
               continue;
         }
         // ..
}
Regards,
Christian
Ranorex Support Team

Re: Multiple tabs

Posted: Wed Aug 05, 2009 5:12 pm
by markwhite
I put it in program.cs
There is an error: The name 'tabPageList' does not exist in the current context.

Code: Select all

Report.Setup(ReportLevel.Info, logFileName, true);
			
            
			foreach(Ranorex.TabPage page in tabPageList.FindChildren<Ranorex.TabPage>())

            try
            {
                //TODO: Code here - for example: 
                
                Rocky.Start();
		Rocky.Start();
                
                         
            }
            catch
         {
               continue;
         }
         // ..
}
    }
}


Re: Multiple tabs

Posted: Thu Aug 06, 2009 8:08 am
by Support Team
That`s only sample code, not copy pastable into the 'program.cs' source file.
It`s not that difficult. You only need to catch the 'ElementNotFound' exception(exception handling: http://msdn.microsoft.com/en-us/library/ms173160.aspx) and go to the next iteration in your loop(http://csharp.net-tutorials.com/basics/loops/)

Regards,
Christian
Support Team