Forum Discussion

DCat1223's avatar
Frequent Contributor
9 years ago

Check if item exists

Hello all...  I have a scripted test I am running against an application that (on ocasion) will display a java popup that requires me to click a checkbox to allow me to continue on to the page I need to access, then click an OK button. 


I have a line of code that basically says if this Java window (Aliases.jp2launcher) exists, click the required button to allow access else, continue on with the test.  This stopped working for some reason or another, and is now failing the test because the Java window isn't appearing.


This is what i had originally:




  Aliases.jp2launcher.wndSunAwtDialog2.Click(45, 277)

 Aliases.jp2launcher.wndSunAwtDialog2.Click(414, 274)




I have been looking through some of the online documentation and have tweaked the statement based on the Jscript example I found but this isn't working either:


  if (Sys.WaitProcess(Aliases.jp2launcher).Exists)


  Aliases.jp2launcher.wndSunAwtDialog2.Click(45, 277);

  Aliases.jp2launcher.wndSunAwtDialog2.Click(414, 274);





I am getting a different error (see attached screenshots)


Can anybody advise as to what the code should say to allow the piece of code to run if the Java window displays, else skip the code and move on to the next line?




  • I solved this.  I ended up having to remap the object.