I have recorded the GUI desktop application using SIKULI as below:
App.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe")
sleep(1)
type ("mganda1"开发者_如何转开发)
sleep(1)
click( ) //click OK
I want to convert this script into Java. So I am trying as below:
package com.arcot.test.vpn;
import org.sikuli.script.*;
public class AuthLogin {
public static void main(String[] args) {
Screen s = new Screen();
App myApp = new App("application-identifier") ;
myApp.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe");
//How to simulate the type, sleep and click functions here?
I am searching for java examples to understand the objects relation and how to use it to simulate the recorded scripts. Please provide if any of you know the links that help me.
Best regards, Madhu
After your program, proceed in following way:
package com.arcot.test.vpn;
import org.sikuli.script.*;
public class AuthLogin {
public static void main(String[] args) {
Screen s = new Screen();
App myApp = new App("application-identifier") ;
myApp.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe");
Kindly proceed in this way, -Create one image folder inside your package "img" -Copy all the respective images in the img folder -Assign the image names in a folder to a different variables
For doing operations, use follwing command:
s.type("mganda1");
s.sleep(time);
s.click("ok.png");
Regards, Npesik
Madhu,
I'm not sure why you recorded the script to lunch that app with sikuli. All of the commands yu use don't invoke any images and can all be written without the sikuli ide.
I would make the following changes to your original sikuli/jython script
App.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe")
sleep(1)
//change to
wait(path to image, FOREVER)
//By changing to a wait there is an implicit find as defined by the path to the image
type ("mganda1")
//if there are issues verifying focus invoke type with the img option
sleep(1)
//use wait instead of sleep
click( ) //click OK
//What are you clicking on?
Regarding Java, here's the link to Sikuli javadocs
精彩评论