LineageGlueRule Error

Bug reports.
User avatar
VanessaS
Posts: 16
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

LineageGlueRule Error

Post by VanessaS » Fri Sep 29, 2017 8:44 am

(Ranorex 7.2, Windows 10, .NET 4.5.2, C# Code, 32-bit Powerbuilder-based AUT)

When I run my test case, I receive the following error and the run slows down noticeably before successfully completing:



My code Looks like this:

*DELETED*

(Edited to add:)

As you can see from the code, I originally had a repo item with a variable xpath. However, to make things easier for our testers (who don't want to fiddle around with paths and code and whatnot), I changed everything around so that they can just select the element they want to use and I get the value of the control and build the xpath in code.



I only receive this error with the new design. Could this be related to the FindSingle method? Is there a workaround for this?
Last edited by VanessaS on Fri Dec 01, 2017 9:26 am, edited 1 time in total.

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: LineageGlueRule Error

Post by Vega » Fri Sep 29, 2017 9:07 pm

I notice that on the line where you are using FindSingle you are not specifying a type and are using the Element type:

Code: Select all

Element myCombobox = Host.Local.FindSingle(varXpathNew);
This should be used as a fallback in my opinion as the element type is a generic object type. It is much better if you specify the type when using FindSingle.

I was creating an example where I could find a combo box on a website:

https://www.w3schools.com/TAGs/tryit.as ... tml_select
w3.png
w3.png (64.75 KiB) Viewed 557 times

If you look at this combobox in Spy, it is actually recognized as a "Select" type. Knowing this, I will call FindSingle like this:

Code: Select all

SelectTag myTag = Host.Local.FindSingle<SelectTag>("/dom[@domain='www.w3schools.com']/body/div[7]/div[4]//iframe[@name='iframeResult']/?/?/select");
So unless Ranorex is actually identifying the object as Element, I would try to avoid using Element. I cannot guarantee this will resolve your issue but it is something that stuck out to me.

Hope this helps!

User avatar
VanessaS
Posts: 16
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: LineageGlueRule Error

Post by VanessaS » Thu Oct 05, 2017 11:13 am

Yes, I had the same thought and tried switching to a different type, but then it doesn't compile. Ranorex only recognizes the combobox as an element, unfortunately.

What it does recognize are the list entries in the drop-down control (which is not the same as the final control that contains the selection), so maybe I can switch to looking through that list instead.

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: LineageGlueRule Error

Post by Vaughan.Douglas » Thu Oct 05, 2017 3:31 pm

VanessaS wrote:Yes, I had the same thought and tried switching to a different type, but then it doesn't compile. Ranorex only recognizes the combobox as an element, unfortunately.

What it does recognize are the list entries in the drop-down control (which is not the same as the final control that contains the selection), so maybe I can switch to looking through that list instead.
That shouldn't cause a build time error, make sure you're declaring your objects correctly and the types match. What is the specific build error you're receiving?
Doug Vaughan

User avatar
VanessaS
Posts: 16
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: LineageGlueRule Error

Post by VanessaS » Fri Oct 06, 2017 8:26 am

You were right. I had a mismatch before and now the combobox-change compiles. But now I get the following:

*DELETED*
"Text" and "Combobox" both don't work, only "Element".

I tried switching to selecting items from the list yesterday, but that didn't work either.

Here's the relevant Code:

Code: Select all

// Build the xpath and find the corresponding repository item.
string varXpathNew = ".//element[@controlid='"+varXpath+"']";
[b]ComboBox myCombobox = Host.Local.FindSingle(varXpathNew);[/b]
Report.Info("Module", "The full xpath for the element is: "+varXpathNew);

// Get initial value of the combo box.
[b]varSelectCombobox = myCombobox.GetAttributeValue<string>("WindowText");[/b]
Last edited by VanessaS on Fri Dec 01, 2017 9:26 am, edited 1 time in total.

User avatar
VanessaS
Posts: 16
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: LineageGlueRule Error

Post by VanessaS » Fri Oct 06, 2017 12:29 pm

Gave up on building the xpath in code. Now I just pass the whole thing as a string and it works without the error. And I've changed it all to "Element", to maintain consistency.

Code: Select all

       public static void CompareElement(string varXpath, string varFindElementEntry, string varSelectElementEntry)
        {
        	// Log-print the entry you are trying to find.
        	Report.Info("Module", "The entry you are seeking is "+varFindElementEntry+" in the element with xPath "+varXpath);

        	// Find the repository item that corresponds to the xPath.
        	Element myElement = Host.Local.FindSingle(varXpath);
        	Report.Info("Module", "The full xpath for the element is: "+varXpath);

        	// Scroll to the top of the element.
        	int myCounter = 20;
        	for(int i = 0; i < myCounter; i++)
      	    	Keyboard.Press(System.Windows.Forms.Keys.Up);
        	
        	// Get the initial value of the element.
        	varSelectElementEntry = myElement.GetAttributeValueText("WindowText");

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: LineageGlueRule Error

Post by Vaughan.Douglas » Fri Oct 06, 2017 12:56 pm

Unfortunately I don't think we're going to be able to provide a direct, clear answer without a SnapShot of some kind.

The challenge for us is that the comboboxes can come in all sorts of different flavors. Sometimes they contain optiontag objects other times they'll be listitem objects. When you identify an object as "element" you're telling Ranorex to treat it very generically. Element has a general set of properties that are inherited by sub classes, so it won't know what to do with it if you then try to treat it as a selecttag.

A few other points I'll point out:
  • I prefer to use tryFindSingle over findSingle because it allows me more control over the code.
  • a combobox element is NOT the same thing as a selecttag element in the eyes of Ranorex.
  • If you're still sticking with a generic element, try webElement as it is more specific than element and includes basic web methods.
Finally in your edit, I'm not entirely clear on what you changed to accommodate your testers. It seems like the only thing that's changed is how you're getting your RxPath, so the find methods shouldn't change.
Doug Vaughan