Element isn't found each time
Element isn't found each time
I have some login username field which I locate in each test at the beginning. For some reason sometimes this text field cannot be found. For example, I run 100 tests and in 4-5 of them this element cannot be found. I turned of ranorex cache.
Do you know what could be a problem?
Regards,
Vajda Vladimir
Do you know what could be a problem?
Regards,
Vajda Vladimir
Re: Element isn't found each time
Please share your block of code that searches for the element.
It sounds like a timing issue. Have you checked the readystate of your AUT before you start searching for the element?
Have you increased the time that Ranorex is allotted to continue searching for an element?
It sounds like a timing issue. Have you checked the readystate of your AUT before you start searching for the element?
Have you increased the time that Ranorex is allotted to continue searching for an element?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Element isn't found each time
This is code which searches for element.
Since this is some excel add in, i start excel and right after that start searching for element. Like this:
My time out is set to 10 minutes, and excel starts in maximum 10-15 seconds so I think it should find this element.
Since this is some excel add in, i start excel and right after that start searching for element. Like this:
Code: Select all
App = new Process();
App.StartInfo.FileName = application;
App.Start();
reportFactoryAddInGuiElements.LoginPane.LoginUserField.Click();
This actually call this property from repository file.
get
{
return _loginuserfieldInfo.CreateAdapter<Ranorex.Container>(true);
}
Re: Element isn't found each time
You may want to add a check after your App.Start to wait for the AUT to fully load and be ready for interaction before you do a search for your element to click.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Element isn't found each time
On what do you mean when you say AUT?
Last edited by WajdaW on Mon Mar 14, 2011 7:51 pm, edited 2 times in total.
Re: Element isn't found each time
Application Under Test.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Element isn't found each time
Shouldn't timeout of 10 minutes take care of this?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Element isn't found each time
What's the exception message and stacktrace you get?
What's the RanoreXPath to the element that fails?
Which version of Ranorex do you use?
Regards,
Alex
Ranorex Team
What's the RanoreXPath to the element that fails?
Which version of Ranorex do you use?
Yes, unless: Have you ensured that the repository folder paths are all unique? E.g. if the RanoreXPath of the repository folder returns the Excel splash screen, then the item will not be found, since Ranorex tries to search inside the splash screen. That's just an example, but splash screens and pop ups always come to my mind when there is an "occasional" problem.WajdaW wrote:Shouldn't timeout of 10 minutes take care of this?

Regards,
Alex
Ranorex Team
Re: Element isn't found each time
Here is stack trace:
I was using ranorex 2.3.5 and had this problem, now I have passed to 3.0 and this problem is still here.
RxPath is:
Sorry, but I'm little bad with English, what do you mean by Excel splash screen?
A screen with nothing on it?
Also, one offtopic question. I have 3 level hierarchy to this element, and each one there (rooted folders and element) have timeout of 10 minutes. And because of that my time out is 30 minutes. How to specify timeout to be 10 minutes for this element, but 10 as well for rooted folders. I don't want to this crashes after 30 minutes, but after 10. How to set those timeouts.
EDIT: About uniqueness of repository items:
I have ensured that only one excel process is running. I think that elements in repository are unique, but not 100% sure. If they are no unique shouldn't this heappen more than 4 times in 100?
Regards,
Vajda
Code: Select all
<![CDATA[Ranorex.ElementNotFoundException : Failed to find item 'Excel2007Repository.Microsoft_Excel.RF_Pane_Login.LoginUserField' within the specified timeout of 30m.
----> Ranorex.ElementNotFoundException : No element found for path 'form[@processname='EXCEL']/element/form/element[@controlname='ExcelTaskPaneHost']/container/element/element/text[@automationid='UserNameTextBox']/container[@automationid='PART_ContentHost']' within 30m.]]></message>
<stack-trace><
at Ranorex.Core.Repository.RepoItemInfo.CreateAdapter[T](Boolean throwException)
at ABZ.OfficeAddInTestLogic.Excel2007RepositoryFolders.RF_Pane_LoginFolder.get_LoginUserField()
at ABZ.OfficeAddInTestLogic.LoginPaneExcel2007.get_LoginUserField()
at ABZ.OfficeAddInTestLogic.ReportFactoryOfficeAddInDriver.Login(String user, String password)
at ABZ.ExcelTest.ExcelStepDefinition.GivenIAmLoggedAsXWithX(String userName, String password)
at lambda_method(ExecutionScope , String , String )
at TechTalk.SpecFlow.Bindings.MethodBinding.InvokeAction(Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.TestRunner.ExecuteStepMatch(BindingMatch match, Object[] arguments)
at TechTalk.SpecFlow.TestRunner.ExecuteStep(StepArgs stepArgs)
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
at ABZ.ExcelTest.RoundingFactsInExcelDocumentFeature.RoundingUpAnItem(String cell, String column, String label, String times, String times2, String cellValue)
--ElementNotFoundException
RxPath is:
Code: Select all
/form[@processname='EXCEL']/element/form/element[@controlname='ExcelTaskPaneHost']/container/element/element/text[@automationid='UserNameTextBox']/container[@automationid='PART_ContentHost']
A screen with nothing on it?
Also, one offtopic question. I have 3 level hierarchy to this element, and each one there (rooted folders and element) have timeout of 10 minutes. And because of that my time out is 30 minutes. How to specify timeout to be 10 minutes for this element, but 10 as well for rooted folders. I don't want to this crashes after 30 minutes, but after 10. How to set those timeouts.
EDIT: About uniqueness of repository items:
I have ensured that only one excel process is running. I think that elements in repository are unique, but not 100% sure. If they are no unique shouldn't this heappen more than 4 times in 100?
Regards,
Vajda
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Element isn't found each time
Hi,
Splash screens are typically used by especially large applications to notify the user that the program is in the process of loading. In other words, they provide feedback that a sometimes lengthy process is under way. A splash screen disappears when the application's main window appears.
Please also try to disable the caching for folders in your repository. How to disable caching
Have you also tried to copy the RxPath to Spy and have you checked if this RxPath is correct in this part of your automation?
Regards,
Peter
Ranorex Team
A splash screen is an image that appears while a game or program is loading.WajdaW wrote:Sorry, but I'm little bad with English, what do you mean by Excel splash screen?
A screen with nothing on it?
Splash screens are typically used by especially large applications to notify the user that the program is in the process of loading. In other words, they provide feedback that a sometimes lengthy process is under way. A splash screen disappears when the application's main window appears.
Please take a look at this docu http://www.ranorex.com/support/user-gui ... eouts.htmlWajdaW wrote:Also, one offtopic question. I have 3 level hierarchy to this element, and each one there (rooted folders and element) have timeout of 10 minutes. And because of that my time out is 30 minutes. How to specify timeout to be 10 minutes for this element, but 10 as well for rooted folders. I don't want to this crashes after 30 minutes, but after 10. How to set those timeouts.
Get you any warning in your Report, that your RxPath is not unique and therefore the absolute RxPath is used to search for the item?WajdaW wrote:I have ensured that only one excel process is running. I think that elements in repository are unique, but not 100% sure. If they are no unique shouldn't this happen more than 4 times in 100?
Please also try to disable the caching for folders in your repository. How to disable caching
Have you also tried to copy the RxPath to Spy and have you checked if this RxPath is correct in this part of your automation?
Regards,
Peter
Ranorex Team
Re: Element isn't found each time
Ah, that is splash screen. 
I'll look for this timeouts.
I have disabled catching at beginning, so caching is off.
I copied RxPath to spy and only one element have been found, and it's that one which I need, so there is no problem with RxPath.
I added Ranorex.Delay(10000) after my app start.
And added to search for this element 3 times, and after this 3 times if doesn't find it that throws exception like this:
Now it works fine.
So what coused this problem? Splash screen?
Is there a better way to do this?
Some ranorex method to work around splash screen?
regards,
Vajda

I'll look for this timeouts.
I have disabled catching at beginning, so caching is off.
I copied RxPath to spy and only one element have been found, and it's that one which I need, so there is no problem with RxPath.
I added Ranorex.Delay(10000) after my app start.
And added to search for this element 3 times, and after this 3 times if doesn't find it that throws exception like this:
Code: Select all
int searchCount = 0;
bool found = false;
while (!found && searchCount < 3)
{
try
{
reportFactoryAddInGuiElements.LoginPane.LoginUserField.Click();
found = true;
}
catch (Exception e)
{
if (searchCount < 3) searchCount++;
else throw e;
}
}
So what coused this problem? Splash screen?
Is there a better way to do this?
Some ranorex method to work around splash screen?
regards,
Vajda
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Element isn't found each time
Hi,
Regards,
Peter
Ranorex Team
As alex wrote in the posting above:WajdaW wrote:So what coused this problem? Splash screen?
To overcome such an issue you have to add different attributes to your Splash screen element than to your application. Then such a problem shouldn't occur anymore.Support Team wrote:E.g. if the RanoreXPath of the repository folder returns the Excel splash screen, then the item will not be found, since Ranorex tries to search inside the splash screen.
Regards,
Peter
Ranorex Team
Re: Element isn't found each time
Of course.Support Team wrote: To overcome such an issue you have to add different attributes to your Splash screen element than to your application. Then such a problem shouldn't occur anymore.

I'll try this.
Regards,
Vajda