Scrolling and storing values

Class library usage, coding and language questions.
deatchlock
Posts: 27
Joined: Mon Mar 19, 2018 10:02 am

Scrolling and storing values

Post by deatchlock » Fri Sep 21, 2018 9:21 am

Hi,

last few days I have been struggling with a problem of scrolling to not visible containers and reading text values from them. The process itself shouldn´t be that complicated but I am having headache of finding out how to do it properly. So far my code works only in the area where the containter is Visible, if I move to the not visible ones (using scroll bar or just calling MoveTo ) and call method for storing the text values from these ones the process always jumps back to the beginning of the screen. In other words it doesn´t want to take the values from that particular container even when the scroll goes down to that particular location it just jumps back to the beginning. Any help would be appreciated.

Thanks
ScrolllingAndStoring.rxsnp
//this is without scrolling just with MoveTo
int lengthContainer = containers.Count;
for (int j = 0; j < lengthContainer; j++)
{
Container c = containers[j];
{
Text t = list[j];
if (c.Visible != true)
{
c.MoveTo();
c.EnsureVisible();
Ranorex.Report.Info(t.Element.GetAttributeValueText("Text"));
Ranorex.Report.Screenshot(t);
//save results of found element to class for xml serialization
helperMethod.GetAndStoreTextPictureAndOCRFromElement(t, path, xmlstorage);
XMLFileConverter.GetXMLFromObject(xmlstorage, currentResultFolder + @"RanorexResult_.xml");

}
}
(282.26 KiB) Downloaded 4 times

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

Re: Scrolling and storing values

Post by Support Team » Fri Sep 21, 2018 7:00 pm

Hi deatchlock,

I will be happy to help with this. It is difficult to say if the issue is your code, your RxPath(s), or something else. I recommend trying a very simple recording module which clicks on one of these elements out of view. If all goes to plan, Ranorex will automatically bring the element into view before clicking on it. If this works as expected then I recommend comparing this recording module's action's code and target element's RxPath with yours (right-click the action > View code).

If not, it is possible the EnsureVisible feature does not work properly for this element and we will need to create our own actions to ensure the elements are visible (such as clicking the scroll bar or pressing the down arrow until the element is visible).

Also a side note, most Ranorex actions automatically call EnsureVisible by default before the action is performed to ensure the element is scrolled into view and the action completes successfully. This can be toggled in the repository's element properties.

If you continue to experience issues, is it possible to share your application under test with us so we may further investigate it since it seems this issue is unique to your application? We can always help you troubelshoot this privately by making a support ticket (please reference this thread if you do this).

I hope this helps!

Kind Regards,
Ned
.
Image

deatchlock
Posts: 27
Joined: Mon Mar 19, 2018 10:02 am

Re: Scrolling and storing values

Post by deatchlock » Mon Sep 24, 2018 12:08 pm

Hi Ned,

thank you for the reply and the proposal. Unfortunately I am not able to get it working. I have completely moved to Visual Studio therefore I don´t use Ranorex as a working framework. Yes, I will contact you withthe support ticket addressing this issue.

Best regards

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

Re: Scrolling and storing values

Post by odklizec » Mon Sep 24, 2018 12:43 pm

Hi,

Looking at the snapshot, there seems to be no reason to scroll the container at all? All texts can be obtained, regardless they are visible or not ;)

Try this xpath:
/form[@title='KePlus MAX']//container/text[@caption='Outputs']/parent::container//text
It returns all texts under container "Outputs". All you need to do now is to read and store the values you want. You will most probably have to use "Type" attribute to distinguish between individual types of texts:
DepoGroup<Label>
PropertyGrid+KeyTextBlock
PropertyGrid+ValueTextBlock
...
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

deatchlock
Posts: 27
Joined: Mon Mar 19, 2018 10:02 am

Re: Scrolling and storing values

Post by deatchlock » Mon Sep 24, 2018 3:11 pm

Hi Odklizec,

thank you a lot you are my savior. These xpaths, I just loose focus on them and make simple thing more complicated.
Thanks :wink: