Example Java Script Using Eggdrive

This example shows how you can use Eggdrive in a Java script. For more information about how to use Eggdrive, see Using Eggdrive.

import de.timroes.axmlrpc.XMLRPCClient;

import de.timroes.axmlrpc.XMLRPCException;

import de.timroes.axmlrpc.XMLRPCServerException;

import codeReference.net.URL;

import codeReference.util.HashMap;

 

public class EggplantDrive {

public static void main (String [] args) {

XMLRPCClient client= null;

try {

client= new XMLRPCClient(new URL("http://127.0.0.1:5400"));

client.call ("StartSession", "/Users/pamela/EggplantTests/EggplantDrive.suite);

System.out.println("Started session");

 

// SUTに接続

client.call("Execute", "Connect (name:\”SUT30\”)");


// Linuxターミナルアイコンをクリックして、次にClose Window(ウインドウを閉じる)ボタンをクリックしてターミナルを閉じます。

client.call("Execute", "Click Terminal");

HashMap clickCommand= (HashMap) client.call("Execute", "Click CloseWindow");

System.out.println("Output from Click command: “ + clickCommand.get(“Output""));


//画面をデスクトップにキャプチャします

client.call("Execute", "CaptureScreen(Name:\”/Users/pamela/Screens”, increment:yes)");


//スクリプトをhelper suiteで実行します

client.call("Execute", "RunWithNewResults (FindImageByHelper)");


//テキストを加えるスクリプトから出力を得ます

HashMap putScript=(HashMap)client.call("Execute, "Put2Lines");

System.out.println("Output from script that puts text: “ + putScript.get(“Output”));


//スクリプトからテキストリターン値を得ます

HashMap returnScript=(HashMap)client.call("Execute", "ReturnText");

System.out.println("Text output from script: " + returnScript.get("Output"));

}

catch(XMLRPCServerException ex) {

System.out.println("Server exception!" + ex);


//サーバーがエラーを発信します。

}

try {

client.call("EndSession");

}

catch (Exception ex) {

System.out.println("End Session exception");

}

}

}

 

This topic was last updated on 2月 01, 2019, at 11:13:23 午前.

Eggplant icon Eggplant.io | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant