Groovy and Jemmy
- Get link
- Other Apps
1. To Bind your Java application with groovy console.
2. To Automate manual steps in groovy console.
1. Bind your Java application with groovy console.
//BindJavaApplication.groovy
import org.netbeans.jemmy.*;
import org.netbeans.jemmy.explorer.*;
import org.netbeans.jemmy.operators.*;
// Fire up the SwingSet2 Application
new ClassReference("SwingSet2").startApplication();
// Get a reference to the SwingSet JFrame and put it into the console's script binding.
mainFrame = new JFrameOperator("SwingSet")
def bind = new Binding()
bind.setProperty("testScript",this)
bind.setProperty("mainFrame",mainFrame)
// Fire up the Groovy console.
def console = new groovy.ui.Console(this.class.classLoader,bind)
console.run()
Thread.sleep(700000)
2 . Automate manual steps in console.
import org.netbeans.jemmy.*;
import org.netbeans.jemmy.explorer.*;
import org.netbeans.jemmy.operators.*;
// Get first button object to click
buttonObj = new JButtonOperator(mainFrame,0)
// to click on button with title “OK” buttonObj = new JButtonOperator(mainFrame,”OK”)
t = new Thread() {
buttonObj .push()
}
t.start()
Hey, what we have just done; we have just clicked first button of SwingSet.
Cheers !! Enjoy Automation.
~NV
- Get link
- Other Apps
Comments
Post a Comment