Current Window close


I am performing following steps -
1)Executing a script (E.g. Say Chrome browser is open )
2)If the script under execution has an error, I have accidentally started a new script (Second script has to launch the Chrome browser again from desktop)
3)This second script is closing the window of the earlier script and it is now in the state where new script is supposed to start(Chrome browser of earlier script that is opened is automatically closed and now desktop is seen)
4)However, the second script does not recognize the image in first action.
5)It does work fine if I restart the second script again. (Second script fails to recognize the image of chrome browser icon unless I restart it)

My questions are -
1)How is the the window opened by first script being closed when no such statement is executed ?
2)Why is the image in first statement of second script not recognized even if the screen is now in base position where the script is supposed to start ?

Vasavi Kaza

There’s really not enough information here to provide answers to any of your questions. For one thing, we don’t know what operating system you’re testing against – that makes a difference as to what the behavior would be.

The thing to be aware of is that eggPlant/the script can’t do anything on the SUT except what you’ve told it to do. All it does is send keyboard and mouse events to the SUT, and it only sends the ones that you’ve told it to via the script. So if your second script is somehow closing a window, it’s because that’s what the scripted actions do when there’s an open window.

The only exception to the above is that by default if an image isn’t found on the first pass of the screen, eggPlant will move the cursor to the lower right corner of the screen, but that shouldn’t cause any windows to close. You can disable this behavior by going to Preferences > Run Options > Mouse and unchecking “Should reposition mouse during image search”. This should not cause any problems in most scenarios.

4)However, the second script does not recognize the image in first action.

If the first action is double-clicking a desktop icon (just a guess) then it’s probably not finding it because the first script leaves it in a selected state, so its appearance is different than that of the current saved image. You can address that by making an image collection that contains both versions of the icon, so your doubleClick command will find it no matter what state it is in.

It would be good to continue this conversation via e-mail, which is our primary mechanism for customer support.

I understand this is happening due to reposition of mouse if Image is not found. I am running the scripts on XP (Written however using Mac system) and see that the reposition is happening actually on top right of the screen, however, why is this click happening instead of mouse just moving over, There is a window close button there and that is being closed.