What is the role of tpAttachChild, tpAttachParent & tpAttachWait.
There's always one more bug.
Performs the search relative to the currently attached object. Use this option when you only want to search for the object to attach to within the context of a specific parent window.
Performs the search within the top-level object only. Use this option when you only want a search to a parent window and none of its children.
Waits until the attach is successful. Playback.AttachDelay determines the wait duration.
Performs the attach without waiting. This suppresses the exception handling and the object receiving the result of the construction function can be validated using the Exists property.
OK, I need TP to wait (intelligently) before it moves to the next object. In my SUT, I have two ComboBoxes. The second ComboBox has conditional values depending on what is selected in the first ComboBox. The second ComboBox also takes a couple/few seconds before it populates.
So my code looks something like
HTMLComboBox("Name=Combobox1", tpAttachWait).Select Item1
HTMLComboBox("Name=Combobox2", tpAttachWait).Select Item2
The problem is TP doesn't wait..
I've tried to set the Playback.AttachDelay to
Playback.AttachDelay = 30
But when I look at the tpAttachWait (by holding the cursor over the word tpAttachWait in my script while I am in debug mode or if I pause my script) the value for tpAttachWait is "8".
I want TP to wait intelligently without using sleeps.
Thanks in advance..
While searching for my issue I got the information about the tpattachwait from the above queries.
My code looks like this:
The above code was working fine, but the code is not working now and it is skipping the actions which are to be performed and giving the runtime error object notfound. As it is not entering the name and clicking on the button and directly going to the next window...it is giving the error.
I want to know why TP not executing the actions in the middle(1,2,3 the numbers which I have placed in the code) and also it is not at all waiting for the window to load even after using tpattachwait. Help me in this regard, so that my scripts run now and in future also well.
I'm not sure if anyone still needs this, but...
"I've tried to set the Playback.AttachDelay to
Playback.AttachDelay = 30
But when I look at the tpAttachWait (by holding the cursor over the word tpAttachWait in my script while I am in debug mode or if I pause my script) the value for tpAttachWait is "8"."
This is because you need to use Playback.AttachTimeOut instead of AttachDelay. Even with AttachTimeOut, though, TP still displays "8" as the tpAttachWait value. Don't worry, it is actually whatever you set it to. TP just doesn't display it as 30.
Just thought I should mention this as I have similar issue.
playback.attachdelay = 10
playback.attachtimeout = 30
If SAPWindow("Information SAPWindow",tpattachwait).Exists = True Then
Do Until SAPWindow("Information SAPWindow",tpattachnowait).Exists=False
However, I notice that the script stops on the 'if' statement indefinitely, I expected it to wait up to 30 seconds and if SAPWindow doesnt exist, to 'end if'.
Hmmmm.... if SAPWindow does not exist it will throw an error because you are using tpAttachWait.
Basically if SAPWindow exist your code is happy else it will stop.
And don't forget to use Sleep inside your "do" loop. Else it will suck your CPU resources without much purpose.
In fact in VB it is recommended to use DoEvents to pass control to the OS.
Is there any other way to check if SAPWindow exists without using '.exists' ?
You could attempt to attach to the window and handle the error when it fails. That would tell you if it exists.