How to find an Element/cell on a Area/Region URGENT HELP

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
mauriPS
Posts: 6
Joined: Fri Jul 11, 2014 8:46 pm

How to find an Element/cell on a Area/Region URGENT HELP

Post by mauriPS » Wed Jul 16, 2014 8:25 pm

hello.
I've been asking a few other questions here and there and nobody seems to help. hopefully someone will help me here.

I got to understand ranorex more and more over these past days.

The problem is I am making a automated test for a desktop application.

There is a point where I get to a window with a scrollingRegion where there are many cells. Each cell with a text value within it.

I would LOVE for someone to help me providing some code of a method or a way I can :

1.Identify the scrollingRegion (done with ranorexSpy/ViewSpy).
2.Identify the specific cell I am looking for by its text contents. (to be done, need help)
3.Once Identified, Select that cell (to be done, need help)

And that is it.

Here is hte part of the code I am working on. Obviously I know it is WRONG. But the logic follows somewhat like this I pressume:

Note:
numeroDeInformePolicial is the cell I am trying to find within the ScrollingRegion in the window.
And scrollingRegion is the ScrollingRegion where these cells are, including the one I want to find.
repo.Contenedor.Siguiente is a reference to a "continue" button, because there is more containers with more cells, the button "repo.Contenedor.Siguiente" helps me to get to the other containers to see if the cell is there. But nonetheless the ScrollingRegion scrollingregion is still the same in all cases.


CODE:

Code: Select all

Cell numeroDeInformePolicial = "/form[@controlname='Contenedor']/element[@controlname='LayoutWorkspace']/?/?/element[@controlname='decwsAreaTrabajo']/?/?/element[@controlname='uebPanel2']//element[@controlname='ultraPanel1']//table[@accessiblerole='Table']/row[1]/cell[@accessiblename='" + NumIP + "'\\ de\\ Informe\\ Policia']";
            Container scrollingRegion = "/form[@controlname='Contenedor']/element[@controlname='LayoutWorkspace']/?/?/element[@controlname='decwsAreaTrabajo']/?/?/element[@controlname='uebPanel2']//element[@controlname='ultraPanel1']//table[@accessiblerole='Table']/container[@accessiblename='Data Area']/container[@accessiblename='Scrolling Region']";
           
            
         	bool mybool = false;
         	do{
         		if(scrollingRegion.FindChildren().Contains(numeroDeInformePolicial.Text = NumIP)){
         			numeroDeInformePolicial.Select();
         			mybool = true;
         		}
         		else if(repo.Contenedor.Siguiente.Enabled){
         			repo.Contenedor.Siguiente.Click();
         		}else if(repo.Contenedor.Siguiente.Enabled == false && mybool == false){
         			Report.Error("cell not found");
         			Report.End();
         		         }
         	}while(mybool == false);


Of course if the continue button "repo.Container.Siguiente" is disabled it means there aren't any more containers with cells along the way. And if "mybool" variable is still false then the cell with the value "NumIP" was not found. And an error is reported, and then we end our reports and I hope with this the test will close.


PLEASE HELP ASAP I NEED THIS RESOLVED BY THE END OF THE WEEK
thanks in advance

mauriPS
Posts: 6
Joined: Fri Jul 11, 2014 8:46 pm

Re: How to find an Element/cell on a Area/Region URGENT HELP

Post by mauriPS » Thu Jul 17, 2014 5:28 pm

I just thought of something, would it be possible to get the coordinates of the cell snapshot or image in the window (the cell defined by its inner text value = NumIP). And then looking for that image region inside our whole window? please respond. And if it is possible. How?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to find an Element/cell on a Area/Region URGENT HELP

Post by Support Team » Tue Jul 22, 2014 3:07 pm

Hi mauriPS,

Unfortunately it is a little hard to help you without having your application and your solution.
May I ask you to send us at least a Ranorex Snapshot file from your application? Maybe the snapshot can help understanding your problem. Much better would be to get your application in order to help solving your problem.

You wrote that numeroDeInformePolicial is the cell you want to find in the scrollingRegion, but the path for the scrolling Region is a different one than the path to the cell.

Cell numeroDeInformePolicial = //table[@accessiblerole='Table']/row[1]/cell[@accessiblename='" + NumIP + "'\\ de\\ Informe\\ Policia'];
Container scrollingRegion = //table[@accessiblerole='Table']/container[@accessiblename='Data Area']/container[@accessiblename='Scrolling Region'];

If you don't want to post your snapshot to the forum you can also write an email to [email protected].

Regards,
Bernhard
.
Image