MouseClick malfunctions
Posted: Thu Dec 09, 2010 3:35 am
Okay, this is really wierd.
I've got an application in development. I was literally minutes away from completing it. It's been running fine for an hour or so and I was just tweaking it here and there.
Then, <Window>.MouseClick(ibutton, ix, iy, itype); stopped working.
The application Phantom is running against is a Java app running as a pop-up in an IE window. For hours and hours Click works just fine in the declared window. Then, it started clicking in a different window. The window OJIN pops up the window MAIN after you go through the window LOGIN. Life is good. Main...SetText and Main...TypeKeys work just fine but Main...MouseClick(...); executes its clicks in the OJIN window.
WTF?!
Here's a grossly simplified test-code I wrote to verify that's what was happening - Any ideas at ALL?
<p>
use "OJIN.dec";
use "Login.dec";
use "Main.dec";
string sURL = "****:xxx.xxx.xxx.xxx:xxxx/location/default.htm";
bool OK;
#sUser and sPW are passed parameters upon calling (Username and Password) Phantom.
System("C:\\Program Files\\Internet Explorer\\iexplore.exe " + sURL);
#NOTE: I had a window Main = MainWin... declaration here but that stopped working after a half dozen runs and
# Phantom decided that the variable already existed at this point
OK = WaitForWindow(OJIN, 20);
if(OK) {
OJIN.TypeKeys("<TAB>" + sURL + "<ENTER>");
window Login = MainWin("*OJIN*", "SunAwtFrame");
OK = WaitForWindow(Login, 20);
if(OK) {
Login.MainWin(1, "SunAwtCanvas").MainWin(1, "Edit").SetText(sUser);
Login.MainWin(1, "SunAwtCanvas").MainWin(2, "Edit").SetText(sPW);
if(!Exists(Login.MainWin(1, "SunAwtCanvas").MainWin(1, "Button"))){
Sleep(5);
}
Login.MainWin(1, "SunAwtCanvas").MainWin(2, "Edit").TypeKeys("<TAB><ENTER>");
window Main = MainWin("OJIN OnLine (xxx.xxx.xxx.xxx)", "SunAwtFrame");
OK = WaitForWindow(Main, 20);
Sleep(1);
}
}
if(OK) {
#Here it clicks in window OJIN rather than MAIN - I've tried a dozen different variations on forcing it to
#click in MAIN but all clicks go to OJIN.
Main.MainWin(1, "Edit").MouseClick(0, 720, 112, 1);
Main.MainWin(1, "Edit").MouseMove(40, 112);
Main.MainWin(1, "Edit").MouseClick(2, 40, 112, 0);
}
</p>
I've got an application in development. I was literally minutes away from completing it. It's been running fine for an hour or so and I was just tweaking it here and there.
Then, <Window>.MouseClick(ibutton, ix, iy, itype); stopped working.
The application Phantom is running against is a Java app running as a pop-up in an IE window. For hours and hours Click works just fine in the declared window. Then, it started clicking in a different window. The window OJIN pops up the window MAIN after you go through the window LOGIN. Life is good. Main...SetText and Main...TypeKeys work just fine but Main...MouseClick(...); executes its clicks in the OJIN window.
WTF?!
Here's a grossly simplified test-code I wrote to verify that's what was happening - Any ideas at ALL?
<p>
use "OJIN.dec";
use "Login.dec";
use "Main.dec";
string sURL = "****:xxx.xxx.xxx.xxx:xxxx/location/default.htm";
bool OK;
#sUser and sPW are passed parameters upon calling (Username and Password) Phantom.
System("C:\\Program Files\\Internet Explorer\\iexplore.exe " + sURL);
#NOTE: I had a window Main = MainWin... declaration here but that stopped working after a half dozen runs and
# Phantom decided that the variable already existed at this point
OK = WaitForWindow(OJIN, 20);
if(OK) {
OJIN.TypeKeys("<TAB>" + sURL + "<ENTER>");
window Login = MainWin("*OJIN*", "SunAwtFrame");
OK = WaitForWindow(Login, 20);
if(OK) {
Login.MainWin(1, "SunAwtCanvas").MainWin(1, "Edit").SetText(sUser);
Login.MainWin(1, "SunAwtCanvas").MainWin(2, "Edit").SetText(sPW);
if(!Exists(Login.MainWin(1, "SunAwtCanvas").MainWin(1, "Button"))){
Sleep(5);
}
Login.MainWin(1, "SunAwtCanvas").MainWin(2, "Edit").TypeKeys("<TAB><ENTER>");
window Main = MainWin("OJIN OnLine (xxx.xxx.xxx.xxx)", "SunAwtFrame");
OK = WaitForWindow(Main, 20);
Sleep(1);
}
}
if(OK) {
#Here it clicks in window OJIN rather than MAIN - I've tried a dozen different variations on forcing it to
#click in MAIN but all clicks go to OJIN.
Main.MainWin(1, "Edit").MouseClick(0, 720, 112, 1);
Main.MainWin(1, "Edit").MouseMove(40, 112);
Main.MainWin(1, "Edit").MouseClick(2, 40, 112, 0);
}
</p>