Search code examples
waitqtpswfobject

QuickTest Professional - Using Type method on SwfObject


I'm developing an automated test suite for an application which uses some text fields which are, however, rather recognized as SwfObjects. As part of the automation, I'd like to type a person's name into one of those objects. Naturally, I'm using the Type method as it's the only one available for a SwfObject.

Sometimes, if I do SwfObject("edit_field").Type "Joe Smith" the application often glitches and QTP manages to fill the field in with a structurally similar but yet different string instead, such as "Jo Smith" or "Joe Snith". This is rather nondeterministic and the results produced can vary significantly. Sometimes, the editable field gets filled with the correct text, but most of the times it doesn't. No amount of Wait or WaitProperty(visible) managed to solve this so far. Has anyone come across this issue before and if so, could you offer some insight into solving it? It might be worth mentioning that the application most likely queries a DB in the background whenever someone types something into that text field.

Many thanks, Paul.


Solution

  • Hi Paul Try this out..

    set keyboard = CreateObject("WScript.Shell")

    SwfObject("edit_field").Click

    keyboard.SendKeys "Joe Smith"