Validate item appeared/ready

Class library usage, coding and language questions.
ekaz
Posts: 5
Joined: Wed Jan 25, 2017 11:32 am

Validate item appeared/ready

Post by ekaz » Wed Jan 25, 2017 5:38 pm

Hey guys, first post of a newbie here.

So I got to the point of automation where I have huge problems with Ranorex automatic typing mechanism. Instead of smoothly typing forever - after a few tests in a row, my filenames start getting shorter and shorter from the beginning.

My solution for now is:
Is there a way that I can verify/validate if the temp unnamed instance of a "new file" is created to know that the text entering field for the name of the file is present? I want the typing function to start ONLY after I've verified the text field existence.

Please let me know what can be done, because this system is incredibly hard for a junior like me.

//OT: if this is a wrong forum - I apologize, please move it wherever it is supposed to be, if I made a mistake.

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

Re: Validate item appeared/ready

Post by odklizec » Thu Jan 26, 2017 8:41 am

Hi and welcome here,

What you can do is to add WaitFor Exists action before the typing action. This should make sure that typing does not start until the input in question exists. The truth is, that if the key sequence action is assigned to an element, it should wait for the availability of the element as well. However, in case of web elements, it may happen that the element is already on page, so Ranorex correctly detects it as available, but it may not be entirely ready yet (because the page is not yet fully loaded) and this may be the source of your problem.

If WaitFor Exists does not help, you can try is to add WaitForDocumentLoaded action (drag & drop DOM element to record table and in the appeared menu go to Invoke Action >> WaitForDocumentLoaded. This should pause the execution of test unitl the page is not fully loaded. Sadly, it may not work with certain webs (typically Ajax powered).

The last resort is adding simple hardcoded Delay action (via Add New Action menu) before KeySequence action. The amount of Delay depends of your experience and some guess work. Just try to add 100ms, if it does not help, add 200ms and so on ;) Unfortunately, Delays are least recommended and reliable type of "wait" action in test automation, so they should be used with caution and only rarely.
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

ekaz
Posts: 5
Joined: Wed Jan 25, 2017 11:32 am

Re: Validate item appeared/ready

Post by ekaz » Thu Jan 26, 2017 9:16 pm

Hello, thank you for your time!
I just wanted to say that I'm working with the OS automation based on Windows UI without recordings :) so as far as I understand - the first option will be best?

Maybe there is a Ranorex method that checks if current directory has any temp files in it?
Last edited by ekaz on Sun Jan 29, 2017 10:30 am, edited 1 time in total.

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

Re: Validate item appeared/ready

Post by odklizec » Fri Jan 27, 2017 8:10 am

Hi,

I'm afraid, I don't know what you mean by "Ramirez method", but I'm sure it's possible to check the cur. dir for presence of files via C#/VB .Net code. You just have to find some samples ;)

As for waiting for control, I would definitely start with WaitFor Exist with combination of WaitForDocumentLoaded method.
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

ekaz
Posts: 5
Joined: Wed Jan 25, 2017 11:32 am

Re: Validate item appeared/ready

Post by ekaz » Sun Jan 29, 2017 10:36 am

Hello,

Sorry for the Ramirez - that's "Ranorex" on autocorrect...
Thank you for the input, I will try digging for other options :)

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

Re: Validate item appeared/ready

Post by odklizec » Mon Jan 30, 2017 8:51 am

Hi,

No, there is definitely no built-in option to check the cur. dir for a presence of files. You will have to cook something up yourself ;)
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