Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just discovered this awesome low level control object,

Set mouse = CreateObject("Mercury.DeviceReplay")

which allows me to do cool things like

mouse.DragAndDrop x, y, x+60, y, 0

My problem is that my monitor set up can prevent this from working: I have two monitors, my main monitor is on the right. Should the application under test be on the left then the x in my method, the abs_x of the object under test, has a negative value. This generates an error. Is there a code-solution to overcome this? I'm happy a different function, or perhaps a means of moving the Browser object to a different monitor.

One of my attempts involved trying to code looping (Windows key + Left) until x has a positive value. I couldn't work out what to write to make that happen though. Suggestions welcome.

share|improve this question
What are you actually doing with the mouse? It is cool that you can move the mouse, but is it useful? In our QTP tests, we only use direct mouse control if there is no other option (and we actually have always found another, better option). If the application under test is displayed on a different computer/monitor configuration, will the object being acted upon always be in the same location? Also, I use multiple monitors, but find that I sometimes get odd behavior from QTP if it is on the secondary monitor, so I always have QTP (now UFT) in the primary monitor. – John Oglesby Oct 11 '13 at 15:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.