Example Ruby Script Using Eggdrive

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

 

require "xmlrpc/client"


# XML-RPC サーバーを表すオブジェクトの作成。

server = XMLRPC::Client.new("192.168.3.102",nil,5400)


#あらゆる既存のセッションの終了を試みます

begin

result = server.call("EndSession")

puts result

rescue


#上記の実行に失敗しても問題ありません。処置の必要はありません

end


#リモートサーバーを呼んでセッションを開始します

result = server.call("StartSession", "c:\\Users\\Support\\Documents\\testing.suite")

puts result


# eggPlantからSUTへの接続を確立します

result = server.call("Execute", "Connect (serverID:\"192.168.3.128\", password:\"eggplanet\")")

output = result["Output"]


# movetoの結果を確認します

puts "MoveTo output: #{output}"


#既存の画像でmovetoコマンドを実行します。

result = server.call("Execute", "MoveTo ChromeShortcut")

output = result["Output"]


# movetoの結果を確認します

puts "MoveTo output: #{output}"


#テキスト値を返すスクリプトを実行します

result = server.call("Execute", "Run DriveTest")

output = result["Result"]


#スクリプトが返した結果を確認します

puts "Script output: #{output}"


#リモートセッションの終了

result = server.call("EndSession")

puts result

 

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