Forum Discussion
Did You try .SetFocus before using .SetText?
I never use setText. I always want to replicate what a user can do so I always use .keys.
This is a massive project that has been running successfully for more than a year.
- tristaanogre9 years agoEsteemed Contributor
The only reason to use .keys rather than .settext is if the data entry field has events associated with it corresponding to actually using the keyboard. Otherwise, the general effect is the same and there is VERY little difference.
That said, auto-wait time outs are usually good so long as there is a good stability in the system. However, one thing I know about Windows 10 is that there is a LOT of background processing that goes on that can slow down a machine, some of the latest updates of Win10 especially. So, it's all together possible that your test machine is being taxed.
Something you can do instead of Auto-Wait is start going through and replacing some of the problematic object calls with the approprate "WaitNNN" methods. There may be some objects that simply take longer on Windows 10 to respond properly.- MulgraveTester9 years agoFrequent Contributor
Thanks tristaanogre,
Yes, I use .keys to make sure that on set focus and on lost focus events are triggered.
All of my fields are identified by the same routine which uses findchild as I search for fields by their ControlID.
I've just written a routine that may help others. It attempts a command and if it fails retries until it is either successful or the attempt limit is reached. It should inhibit any "The window does not respond" errors and allow the test to retry the command so that subsequent test steps do not fail.
For example:
Instead of: fieldObj.clickitem(choiceIndex)
Use this to attempt the above command 3 times: call tryThis("[0].clickitem([1])", array(fieldObj, choiceIndex), 3)
sub tryThis(byVal mycommand, byVal objArray, byval attempts)
'Tries a command and if it fails repeats it until it passes or the attempt limit is reached
'Since the command may refer to local objects the objects are passed in an array and referenced in mycommand surrounded by [ ]
'EXAMPLE: call tryThis("[0].clickitem([1])",array(fieldObj,choiceIndex), 3)
'DOES THIS: fieldObj.clickitem(choiceIndex)
cmdArray = split(myCommand,"[")
myCommand = ""
for i = 0 to ubound(cmdArray)
cmdElement = split(cmdArray(i), "]")
if ubound(cmdElement)=1 then
cmdArray(i) = "objArray(" & cmdElement(0) & ")" & cmdElement(1)
end if
myCommand = myCommand & cmdArray(i)
next
err.clear
on error resume next
execute myCommand
if err.number<>0 and attempts > 1 then
log.Event("Command failed (" & myCommand & "). Will retry the command.")aqutils.delay 500
call tryThis(myCommand, attempts - 1)
end if
on error goto 0
end sub
Related Content
- 12 months ago
Recent Discussions
- 4 days ago
- 4 days ago