EnsureVisible ("Use Ensure Visible") is causing menu to close and element to scroll to a hidden area
Posted: Fri Jan 25, 2019 8:58 pm
I am currently using Ranorex to perform testing on an application called SuccessFactors from SAP (I'm not from SAP).
The problem is that when I am running test in one of the screen, I start getting several warning messages like this in the report:
After much tinkering and hair pulling, I've finally figured out the source of the issue was the "Use Ensure Visible" option on each object. When I set this to "False" for the problematic objects, then Ranorex had no problem finding the element and clicking on them. Of course, now I've lost the ability to bring these elements into view if it goes out of view for whatever reason.
---
Here are 2 issue types that I've come across. First one generates the "Element is no longer valid" warning", and second one does not show any warning but just fails to click the right item.
Issue 1:
I'm trying to get Ranorex to click on the menu item highlighted below but it appears Ranorex doesn't think it's visible because it caused the page to shift as if trying to scroll it into view. That caused the menu to be closed just as Ranorex was about to click it and it resulted in the warning message above. ---
Issue 2:
This issue is a bit difficult to describe in words but I'll give it a shot. I'm trying to get Ranorex to click on the "Goal Name" column header in the following screenshot: Again, it appears Ranorex doesn't think it's in view and tries to scroll it to the stop of the viewable area in the browser frame (i.e. right under the address bar). But, when it does that, it scrolls it right under the section header like this: The screenshot is what happened when I tried to highlight it. The red square in the second screenshot is highlighting by Ranorex, not me.
So, during the actual test run, the same thing happens and the click occurs on the "Best Practice Admin" dropdown menu because target element is behind the menu element.
The problem is that when I am running test in one of the screen, I start getting several warning messages like this in the report:
And realize that the element was not clicked because Ranorex could not find the element.Could not get a valid element rectangle from '{ATag:}', since the element is no longer valid.
After much tinkering and hair pulling, I've finally figured out the source of the issue was the "Use Ensure Visible" option on each object. When I set this to "False" for the problematic objects, then Ranorex had no problem finding the element and clicking on them. Of course, now I've lost the ability to bring these elements into view if it goes out of view for whatever reason.
---
Here are 2 issue types that I've come across. First one generates the "Element is no longer valid" warning", and second one does not show any warning but just fails to click the right item.
Issue 1:
I'm trying to get Ranorex to click on the menu item highlighted below but it appears Ranorex doesn't think it's visible because it caused the page to shift as if trying to scroll it into view. That caused the menu to be closed just as Ranorex was about to click it and it resulted in the warning message above. ---
Issue 2:
This issue is a bit difficult to describe in words but I'll give it a shot. I'm trying to get Ranorex to click on the "Goal Name" column header in the following screenshot: Again, it appears Ranorex doesn't think it's in view and tries to scroll it to the stop of the viewable area in the browser frame (i.e. right under the address bar). But, when it does that, it scrolls it right under the section header like this: The screenshot is what happened when I tried to highlight it. The red square in the second screenshot is highlighting by Ranorex, not me.
So, during the actual test run, the same thing happens and the click occurs on the "Best Practice Admin" dropdown menu because target element is behind the menu element.