Ranorex not loading correct list page

Ask general questions here.
jlowder
Posts: 55
Joined: Wed Dec 30, 2009 2:56 pm

Ranorex not loading correct list page

Post by jlowder » Mon Jan 25, 2010 10:28 pm

Hi again,

I have a list which displays about 10 items at a time. When selecting from this list I first tell it to click on the bottom list item and then if it doesn't find the correct list item(by caption name) to hit the down arrow key 10 times to bring up a new page in the list. It continues to do this until it finds the correct caption name - and this works. The first time.

Each time this list is accessed, it starts back at the very first page, not where it previously left off. I've discovered that when my scripts access the list a second time it thinks the second page of items is still in view and selects the corresponding list item which would have been the right one. It is not, however, the correct list item. Had the list been on the second page, the item Ranorex selected would have been the correct one. So it seems that the tool isn't refreshing its memory of the displayed list correctly. And I'm making my selections based on Caption Name and not Index. If I stop the script and use the spy to look at the items, the correct information is being displayed.

How do I go about forcing Ranorex to reload the list in memory during the script execution so that it sees the correct values?

Thanks,

Jason

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

Re: Ranorex not loading correct list page

Post by Support Team » Tue Jan 26, 2010 10:17 am

jlowder wrote:How do I go about forcing Ranorex to reload the list in memory during the script execution so that it sees the correct values?
Ranorex always gets the latest information unless you tell it to cache data using a CacheSessionContext. How do you get the list items from the list? Could you please post your the code that retrieves the list items?

Regards,
Alex
Ranorex Support Team
.
Image

jlowder
Posts: 55
Joined: Wed Dec 30, 2009 2:56 pm

Re: Ranorex not loading correct list page

Post by jlowder » Tue Jan 26, 2010 2:35 pm

Hi Alex,

Sure:

public static void AddParser(string parserStepName, RepoItemInfo parser)
{

Text parserName;

repo.Gen2Interface.ParsingTab.Parsers.AddParser.Click();
repo.Gen2Interface.ParsingTab.AddParserDialog.TextStepName.Click();
Keyboard.Press(parserStepName);

repo.Gen2Interface.ParsingTab.AddParserDialog.ParserComboBox.Click();
repo.Gen2Interface.ParsingTab.AddParserDialog.ParsersList.BottomParser.Click();
repo.Gen2Interface.ParsingTab.AddParserDialog.ParserComboBox.Click();

Delay.Milliseconds(1500);

// If the parser isn't showing in the list, press down arrow 10 times to bring a full page of new parsers into view
while (!parser.Exists(out parserName) || parserName.Visible == false)
{
for (int x = 0; x<10; x++)
{
Keyboard.Press("{Down}");
}

Delay.Milliseconds(3500);
}

// Is it clicking the correct parser?
Debug.Print(Convert.ToString(parserName));
parserName.Click();
Delay.Milliseconds(1500);

The parserName value is the correct one, however it isn't even visible.

Jason

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

Re: Ranorex not loading correct list page

Post by Support Team » Wed Jan 27, 2010 6:09 pm

Hmm, maybe the Visible attribute returns true even if the element is not really visible?
What Ranorex version do you have? And what type of application do you automate (WinForms, WPF, Web, ...)?

Regards,
Alex
Ranorex Support Team
.
Image

jlowder
Posts: 55
Joined: Wed Dec 30, 2009 2:56 pm

Re: Ranorex not loading correct list page

Post by jlowder » Wed Jan 27, 2010 7:15 pm

Hi Alex,

I have version 2.2.1.7599, working on a web app using Flash.

Is there a better way to try to access the list items?

Thanks,

Jason
Attachments
listbox.jpg
listbox.jpg (27.75 KiB) Viewed 972 times

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Ranorex not loading correct list page

Post by Ciege » Wed Jan 27, 2010 8:44 pm

jlowder wrote: Is there a better way to try to access the list items?
Can you get the X/Y coords of the element (using element.location.x & element.location.y) and compare it to the size of the display window? If it is off screen the X/Y coords *should* be of a location that does not fit within the display.

I have a scenario with my DevExpress grids where if location.x == 0 then I know a cell is off screen down and if location.x < 0 then I know the cell is off screen right.

Code: Select all

//If cell is off screen down
while (cell.Element.Location.X == 0)
{
  //Report.Warn("Location.X = " + cell.Element.Location.X.ToString());
  //Report.Warn("Go down");
  Keyboard.Press("{PageDown}");
  Thread.Sleep(1000);
}

//if cell is off screen right
while (cell.Element.Location.X < 0)
{
  //Report.Warn("Location.X = " + cell.Element.Location.X.ToString());
  //Report.Warn("Go right");
  HDPageRightButton.Press();
  Thread.Sleep(1000);
}
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...

jlowder
Posts: 55
Joined: Wed Dec 30, 2009 2:56 pm

Re: Ranorex not loading correct list page

Post by jlowder » Wed Jan 27, 2010 8:57 pm

Hi Ciege,

I know they are on screen because I can select any of the list items on the bottom half and run my tests successfully once. It's only when accessing the list a second time that Ranorex believes it is acting on bottom page items. It is clearly behaving as if it thinks the list is still scrolled down to the bottom when it isn't.

I've even tried creating a generic item path and clicking on it manually like:

repo.Gen2Interface.ParsingTab.AddParserDialog.GenericParser.GenericParserInfo.Path = "list/*/*/listitem/text[@caption='" + parserStepName + "']";

repo.Gen2Interface.ParsingTab.AddParserDialog.GenericParser.GenericParser.Click();

and the same problem happens.. It'll work fine until the second time it needs to access a bottom of the list item.

Jason

jlowder
Posts: 55
Joined: Wed Dec 30, 2009 2:56 pm

Re: Ranorex not loading correct list page

Post by jlowder » Wed Jan 27, 2010 9:18 pm

Ok, a co-worker tried an alternate route that eventually worked. For some reason this code:

repo.Gen2Interface.ParsingTab.AddParserDialog.GenericParser.GenericParserInfo.Path = "list/*/*/listitem/text[@caption='" + parserStepName + "']";

while (!repo.Gen2Interface.ParsingTab.AddParserDialog.GenericParser.GenericParserInfo.Exists())
{
for (int x = 0; x<9; x++)
{
Keyboard.Press("{Down}");
}

Delay.Milliseconds(3500);
}

repo.Gen2Interface.ParsingTab.AddParserDialog.GenericParser.GenericParser.Click();


works, while passing in the ObjectInfo and accessing the text does not. The prior method works on several other lists, but not this one. Don't know what the issue is but it's good to know that the same code won't always work properly..

Jason

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

Re: Ranorex not loading correct list page

Post by Support Team » Thu Jan 28, 2010 12:17 pm

Hmm, for me both code snippets look equivalent. I can't see a reason why one of the two snippets should work and one not. There needs to be something different in the way those code snippets are used.
jlowder wrote:it's good to know that the same code won't always work properly
Well, it will always work properly on the same kind of control. However, there are different list controls out there, many of them have different implementations and consequently they can have different representationis in Ranorex, too.

Regards,
Alex
Ranorex Support Team
.
Image