Element marked as "invalid" even though it's right there

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
corissa
Posts: 20
Joined: Tue Feb 14, 2017 9:11 pm
Location: Portland, Maine

Element marked as "invalid" even though it's right there

Post by corissa » Thu Jun 29, 2017 3:54 pm

Hi there,

Not sure if this is a bug or not, so I'm trying it in this forum first.

Version: Ranorex 7.1
System: Windows 10

Basically, there is an element in my .NET application that is definitely there, and I can see it, and see that it's usable, I can click it myself manually and it works. But for some weird reason, Ranorex keeps calling it invalid. I don't understand why, I have deleted and re-added the element, I have written out its RanoreXPath in detail as you can see in the screenshot below. I just don't understand why the Spy keeps marking it as red and can't "see" it even though it's right there.

Any help with this would be greatly appreciated. I've been trying to figure it out for days and hoping the new update (7.1) would fix it. When I installed Ranorex 7.1, the recording ran successfully once. After that, it has continually marked the element as invalid. I'm at a loss.

Thanks for your help,
C
Attachments
UPCGTINInApp.png
Where it is in our program
UPCGTINInApp.png (5.1 KiB) Viewed 585 times
ItemChoicePopup.rxsnp
Snapshot of the popup
(269.95 KiB) Downloaded 21 times
DesktopRibbonForm.rxsnp
Snapshot of the application
(136.32 KiB) Downloaded 23 times

corissa
Posts: 20
Joined: Tue Feb 14, 2017 9:11 pm
Location: Portland, Maine

Re: Element marked as "invalid" even though it's right there

Post by corissa » Thu Jun 29, 2017 3:55 pm

here's the path in Ranorex, to show that I've hashed out all the details of the path.
Attachments
UPCGTINRow0.png
UPCGTINRow0.png (48.38 KiB) Viewed 584 times

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

Re: Element marked as "invalid" even though it's right there

Post by odklizec » Thu Jun 29, 2017 4:42 pm

Hi,

Please post here the entire xpath from repository, so we can examine full xpath. And please post also exact error message you are getting. If the test randomly succeeds, then the most probable reason is that the element is accessed too early, when it's not fully loaded yet. But without knowing the exact error and full xpath, it's just a wild guess. Also, what you can do is to add log snapshot action just before the failing action. This way you can compare the snapshot (for failing action) with previous (good) one. Maybe your app randomly changes something in gui? ;)
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

corissa
Posts: 20
Joined: Tue Feb 14, 2017 9:11 pm
Location: Portland, Maine

Re: Element marked as "invalid" even though it's right there

Post by corissa » Thu Jun 29, 2017 4:52 pm

odklizec wrote:Hi,

Please post here the entire xpath from repository, so we can examine full xpath. And please post also exact error message you are getting. If the test randomly succeeds, then the most probable reason is that the element is accessed too early, when it's not fully loaded yet. But without knowing the exact error and full xpath, it's just a wild guess. Also, what you can do is to add log snapshot action just before the failing action. This way you can compare the snapshot (for failing action) with previous (good) one. Maybe your app randomly changes something in gui? ;)
Thanks for your help on this!

The first time I ran it after the update to 7.1 this morning, it worked, but it has not worked since, not a single time. So I don't know if I can grab the "good" action in a snapshot because I can't replicate it.

My full RanoreXPath in Spy is this (This is the one I created this morning after the update):
/form[@controlname='ItemChoiceForm']/form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table[@accessiblerole='Table']/container[@accessiblename='Data Panel']/row[@accessiblename='Row 1']

I've attached some images I hope are helpful, including one of the "does not exist" even though I am looking at it and can interact with it manually.
Attachments
weirderror.png
in the Spy, it won't show any paths above either...
weirderror.png (26.38 KiB) Viewed 580 times
error.png
error.png (108.41 KiB) Viewed 580 times

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Element marked as "invalid" even though it's right there

Post by krstcs » Thu Jun 29, 2017 6:37 pm

It appears that you have 2 "form" objects in your path. You should only have one, usually in the base app object in the repo (the greyed-out one in the xpath).

Your path looks like this:
/form[@controlname='ItemChoiceForm']/form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table[@accessiblerole='Table']/container[@accessiblename='Data Panel']/row[@accessiblename='Row 1']

Which means in the repo it's like this:
Base object in repo ->/form[@controlname='ItemChoiceForm']
Child Element path -> /form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table[@accessiblerole='Table']/container[@accessiblename='Data Panel']/row[@accessiblename='Row 1']

Notice how both have the "/form[@controlname='ItemChoiceForm']" part? Take that out of the child element's path and see what happens.
Shortcuts usually aren't...

corissa
Posts: 20
Joined: Tue Feb 14, 2017 9:11 pm
Location: Portland, Maine

Re: Element marked as "invalid" even though it's right there

Post by corissa » Thu Jun 29, 2017 6:44 pm

krstcs wrote:It appears that you have 2 "form" objects in your path. You should only have one, usually in the base app object in the repo (the greyed-out one in the xpath).
...

Take that out of the child element's path and see what happens.
Hi krstcs, thanks for showing up :) Glad to see you.

Here's my new RanoreXPath:
/form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table[@accessiblerole='Table']/container[@accessiblename='Data Panel']/row[@accessiblename='Row 1']

Though now it gives me a different error, which I've attached a screenshot of. What do you think? It still says it doesn't exist, even though I can see it in the Ranorex SS.
Attachments
newerror.png
newerror.png (95.17 KiB) Viewed 574 times

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Element marked as "invalid" even though it's right there

Post by krstcs » Thu Jun 29, 2017 6:53 pm

Try looking at the element that is failing validation by using Ranorex Spy. Make sure that the new path matches exactly what you are looking for in the validation.

Most of the time these issues are simply that the RanoreXPath needs to be updated to more accurately identify the intended element.
Shortcuts usually aren't...

corissa
Posts: 20
Joined: Tue Feb 14, 2017 9:11 pm
Location: Portland, Maine

Re: Element marked as "invalid" even though it's right there

Post by corissa » Thu Jun 29, 2017 7:01 pm

krstcs wrote:Try looking at the element that is failing validation by using Ranorex Spy. Make sure that the new path matches exactly what you are looking for in the validation.

Most of the time these issues are simply that the RanoreXPath needs to be updated to more accurately identify the intended element.
Hmmm, okay! I'll keep playing with the RanoreXPath and see if I can get it to work. Thanks again!

corissa
Posts: 20
Joined: Tue Feb 14, 2017 9:11 pm
Location: Portland, Maine

Re: Element marked as "invalid" even though it's right there

Post by corissa » Thu Jun 29, 2017 7:56 pm

Well, I've tried a few times to adjust the RanoreXPath with the Spy and Tracking, but I can't seem to get it work, even still. Now it's doing what it was doing yesterday, where it highlights several elements in red.

I'm going to see if adjusting the RanoreXPath for the parent elements will help, but any other troubleshooting suggestions would be great.
Attachments
redinvalidinspy.png
redinvalidinspy.png (25.68 KiB) Viewed 566 times

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

Re: Element marked as "invalid" even though it's right there

Post by odklizec » Fri Jun 30, 2017 7:06 am

Hi,

I'm somewhat confused ;) What is the DesktopRibbonForm.rxsnp snapshot good for? I mean, this snapshot has clearly nothing to do with the xpath you posted and so Ranorex obviously fails find the element (row) mentioned in the xpath?

I was successful to find the element in the other snapshot you posted (temChoicePopup.rxsnp) with below xpath:
/form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table[@accessiblerole='Table']/container[@accessiblename='Data Panel']/row[@accessiblename='Row 1']
However, you can't use this xpath for AttributeEqual validation! I mean definitely not for the one as you have it in your recording! The above xpath reads entire table row, not just the specific cell with content you want to validate. So to be able to validate a cell in table (its content), you need to make the xpath more specific...
/form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table/container[@accessiblename='Data Panel']/row/cell[@accessiblename='UPC/GTIN row 0']
Could you please post the snapshot for the failed xpath in your last post? This xpath works fine with the snapshot you posted previously, so if it fails for you, the table in question must have different structure?
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

corissa
Posts: 20
Joined: Tue Feb 14, 2017 9:11 pm
Location: Portland, Maine

Re: Element marked as "invalid" even though it's right there

Post by corissa » Fri Jun 30, 2017 2:25 pm

odklizec wrote:I'm somewhat confused ;) What is the DesktopRibbonForm.rxsnp snapshot good for? I mean, this snapshot has clearly nothing to do with the xpath you posted and so Ranorex obviously fails find the element (row) mentioned in the xpath?
The DesktopRibbonForm snapshot is the whole application - I was hoping maybe that would help with solving the issue? Apparently not. ;) Sorry about that.
odklizec wrote:However, you can't use this xpath for AttributeEqual validation! I mean definitely not for the one as you have it in your recording! The above xpath reads entire table row, not just the specific cell with content you want to validate. So to be able to validate a cell in table (its content), you need to make the xpath more specific...
/form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table/container[@accessiblename='Data Panel']/row/cell[@accessiblename='UPC/GTIN row 0']
Could you please post the snapshot for the failed xpath in your last post? This xpath works fine with the snapshot you posted previously, so if it fails for you, the table in question must have different structure?
I bet that's what the issue is. I wonder if it's not specific and it's looking for the whole Row, instead of just the cell I want!

Side note here is also that for some reason it has worked the last 5 times I ran it this morning... No idea what "fixed" itself but I'll take it. This is the RanoreXPath that's working:
/form[@controlname='ItemChoiceForm']/element[@controlname='itemListFieldStackGrid']/table[@accessiblerole='Table']//cell[@accessiblename='UPC/GTIN row 0']