Ranorex.Table Item cannot be accessed

Class library usage, coding and language questions.
MichalSk
Posts: 35
Joined: Fri Jul 10, 2020 9:23 am
Location: Pforzheim, Germany

Ranorex.Table Item cannot be accessed

Post by MichalSk » Mon Aug 24, 2020 2:56 pm

Hello together,

I wrote some code where I want to search the entire table for a specific content (string).
The Table is getting set as an parameter and my problem is that while I'm debugging, the table is "empty" and his members are "Timeout".. (see: Table_Members_Values.jpg)

I never experienced something similiar yet and need some help. Has anybody an idea why the table parameter isn't getting set properly?

Here is the code for the method:

Code: Select all

        /// <summary>
	/// Searches for a cell text inside the specified table
	/// </summary>
	/// <param name="cellContent">The string which should be contained in one of the cells</param>
	/// <param name="table">Path for the table</param>
	[UserCodeMethod]
	public static bool IsCellAlreadyInTable(string cellContent, Table table)
        {
			Report.Log(ReportLevel.Info, table.Rows.Count.ToString());
			foreach (var row in table.Rows)
			{
				foreach (var rowCell in row.Cells.Where(c => c.Element.GetType().Equals(typeof(Row))).Cast<Row>())
				{
					if (rowCell.Cells.Any(rc => rc.Text.Trim()==cellContent))
					{
						Report.Log(ReportLevel.Info, $"The Part Type {cellContent} already exists in the table.");
						return true;
					}
				}
			}
			Report.Log(ReportLevel.Info, $"Couldn't find the Part type: {cellContent} in the table.");
			return false;
	}
Attachments
Table_Members_Values.jpg
Table_Members_Values.jpg (848.2 KiB) Viewed 91 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex.Table Item cannot be accessed

Post by odklizec » Tue Aug 25, 2020 7:33 am

Hi,

I'm afraid, this kind of issue is not solvable without access to the app under test or a small sample app, featuring the problematic table. At very least, we need Ranorex snapshot (not screenshot) of the problematic table. Could you please post either the sample app or snapshot? Also, please make sure you are using most recent Ranorex 9.3.2 and not something obsolete ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

MichalSk
Posts: 35
Joined: Fri Jul 10, 2020 9:23 am
Location: Pforzheim, Germany

Re: Ranorex.Table Item cannot be accessed

Post by MichalSk » Tue Aug 25, 2020 9:28 am

Hi,

alright I already thought you will need more informations :)
In the attachments I provided you a snapshot of the problematic table.

Btw. here is the code where I call the method which I provided you above:

Code: Select all

            if (myRepo.Teamsoft.MainTabControl.PartTypesTableInfo.Exists(5000))
            {
                // Check if Part Type is already created and exists in the table
                var isPartTypeAlreadyCreated = TableLibrary.IsCellAlreadyInTable(PartTypeName, myRepo.Teamsoft.MainTabControl.PartTypesTable);
                if (!isPartTypeAlreadyCreated)
                {
                    // Close the Display menu
                    Mouse.Click(myRepo.Teamsoft.MainTabControl.WizardCompleteButton);
                    // Create new Type
                    CreatePartType();
                    Report.Log(ReportLevel.Success, $"The Part Type: {PartTypeName} has been created!");
                }
            }
The first if section gets passed, where I call the Info Object of the table, but as I mentioned already the second parameter: "myRepo.Teamsoft.MainTabControl.PartTypesTable" gives me "Timeout objects" back.

Thanks in advance!
Attachments
Problematic_Table.rxsnp
(2.2 MiB) Downloaded 3 times
Last edited by MichalSk on Tue Aug 25, 2020 9:29 am, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex.Table Item cannot be accessed

Post by odklizec » Tue Aug 25, 2020 9:29 am

Hi,

I'm afraid you forgot to attach the snapshot file? ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

MichalSk
Posts: 35
Joined: Fri Jul 10, 2020 9:23 am
Location: Pforzheim, Germany

Re: Ranorex.Table Item cannot be accessed

Post by MichalSk » Tue Aug 25, 2020 9:30 am

odklizec wrote:
Tue Aug 25, 2020 9:29 am
Hi,

I'm afraid you forgot to attach the snapshot file? ;)
I dont know what you saying budy :wink:

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex.Table Item cannot be accessed

Post by odklizec » Tue Aug 25, 2020 9:51 am

Ha, it's visible now ;) Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

MichalSk
Posts: 35
Joined: Fri Jul 10, 2020 9:23 am
Location: Pforzheim, Germany

Re: Ranorex.Table Item cannot be accessed

Post by MichalSk » Wed Aug 26, 2020 10:15 am

Hello everyone and @odklizec,

do you have any ideas or a solution to fix my problem?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex.Table Item cannot be accessed

Post by odklizec » Thu Aug 27, 2020 10:32 am

Hi,

I'm sorry, I'm currently unable to analyze your issue in details. Maybe someone else will be able to check it?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

MichalSk
Posts: 35
Joined: Fri Jul 10, 2020 9:23 am
Location: Pforzheim, Germany

Re: Ranorex.Table Item cannot be accessed

Post by MichalSk » Mon Aug 31, 2020 9:21 am

odklizec wrote:
Thu Aug 27, 2020 10:32 am
Hi,

I'm sorry, I'm currently unable to analyze your issue in details. Maybe someone else will be able to check it?
Hello,

no problem, you already helped me many times ;) If there will be a chance, it would be great if you could watch after it.

Anybody else have an idea?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex.Table Item cannot be accessed

Post by odklizec » Mon Aug 31, 2020 10:44 am

Hi,

Sadly, the snapshot does not reveal anything weird about the table in question. So I think this kind of issue is not solvable without seeing the app under test and debugging the problem directly on it? Just an idea, have you tried it on another computer? And since the table is WPF based, try to set Show all elements and Realize items in virtualizing containers options to false (in Ranorex settings >> Plugins tab >>WPF section).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

MichalSk
Posts: 35
Joined: Fri Jul 10, 2020 9:23 am
Location: Pforzheim, Germany

Re: Ranorex.Table Item cannot be accessed

Post by MichalSk » Mon Aug 31, 2020 2:41 pm

Hello,

thanks for the ideas. I checked the Plugins Tab and both settings that you mentioned are already set to false.
I tried new things and checked my code, but I still can't find the problem..

It's weird because in Spy I can find the element without any problems (attachment: Table_Found_In_Spy)
but as soon as I debug it in code i get all the timeouts and when hovering over the variable to see the value, the IDE begings to lag and sometimes even crashes :? (attachment: Table_under_Debugging.png)

Maybe with this kind of information you have an idea what the problem might be?
Attachments
Table_Found_In_Spy.PNG
Table_Found_In_Spy.PNG (56.03 KiB) Viewed 38 times
Table_under_Debugging.png
Table_under_Debugging.png (96.12 KiB) Viewed 38 times