This UDF provides automation support for Java applications

本文介绍了一种使用AutoIt实现Java应用程序自动化测试的方法,包括安装所需软件环境、具体操作步骤及提供的自动化函数。适用于Swing或AWT开发的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

This UDF currently automates standalone applications and browser-based applets, developed in either Swing or the Abstract Window Toolkit (AWT).

REQUIREMENTS:

  • AutoIt3 3.2 or higher
  • Java Runtime Environment (JRE) 1.4 or above
  • Java Access Bridge for the Microsoft Windows Operating System
  • Microsoft Visual C++ 2008 Redistributable
  • AutoIT for Java Access dynamically linked library (DLL)
  • Tesseract UDF 0.6
  • Manual check and update of the Java Access Bridge
INSTALLATION:

To install the latest Java Runtime Environment (JRE):

  • Open the web page http://java.com/en/download/manual.jsp.
  • Click Windows XP/Vista/2000/2003 Offline.
  • Save the file to your computer and run it (ie. jre-6u11-windows-i586-p-s.exe).
  • Follow the installation instructions.
  • Restart your computer when prompted.
To install the  Java Access Bridge  for the Microsoft Windows Operating System:

  • Open the web page Java Access Bridge.
  • Click Download Java Access Bridge 2.0.1.
  • Click I agree to the Software License Agreement.
  • Click Continue.
  • Click accessbridge-2_0_1.exe.
  • Save the file to a location on your computer.
  • Run the file accessbridge-2_0_1.exe from your computer.
  • Follow the installation instructions.
  • Restart your computer when prompted.
To install the  Microsoft Visual C++ 2008 Redistributable :

  • Open the web page http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en.
  • Click Download.
  • Save the file to a location on your computer.
  • Run the file vcredist_x86.exe from your computer.
  • Follow the installation instructions.
To install the  AutoIT for Java Access  dynamically linked library (DLL):

  • Right-click on the link AutoITJavaAccess.dll below.
  • Save the file to your Windows System32 folder (ie. C:\WINDOWS\system32).
To install the  Tesseract UDF  0.6:

To manually check and update the Java Access Bridge:

Note:- This step should be performed in addition to the install of the Java Access Bridge above.

  • Using Windows Explorer, go to your Java folder C:\Program Files\Java.
  • Open the first subfolder (ie. j2re1.4.2_19).
  • Go to the subfolder lib\ext.
  • If the files access-bridge.jar and jaccess.jar already exist then go to step 9 below.
  • Copy the file access-bridge.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • If the subfolder in step 2 above starts with j2re1.2 or jre1.2, then copy the file jaccess-1_2.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • If the subfolder in step 2 above starts with j2re1.3 or jre1.3, then copy the file jaccess-1_3.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • If the subfolder in step 2 above starts with j2re1.4 or jre1.4, then copy the file jaccess-1_4.jar to this subfolder (ie. C:\Program Files\Java\jre1.4.2_19\lib\ext).
  • Repeat steps 3 to 8 for every subfolder within the Java folder.

To confirm that the installation process was successful:

  • Using Windows Explorer, go to C:\Program Files\Java Access Bridge and double-click JavaFerret.exe.
  • In the Java Ferret window, select the menu item JavaEvents -> Track Mouse Events.
  • Drag your mouse over any Java application, and the Java Ferret window should dynamically update with information about the Java objects as you drag your mouse over them.
LIST OF FUNCTIONS:

  Quote

_JavaAttachAndWait($win_title)

_JavaObjValueGet($autoit_cntl_id, $javaferret_obj_name = "", $javaferret_obj_role = "", $instance_num = 1)

_JavaObjIndexGet($autoit_cntl_id, $javaferret_obj_name = "", $javaferret_obj_role = "", $instance_num = 1)

_JavaObjValueSet($autoit_cntl_id, $javaferret_obj_name, $javaferret_obj_role, $object_value, $instance_num = 1, $partial = 1, $get_last_capture = 0, $delimiter = "", $expand = 1, $scrolling = 1, $cleanup = 1, $max_scroll_times = 5, $scale = 2, $left_indent = 0, $top_indent = 0, $right_indent = 0, $bottom_indent = 0, $show_capture = 0)

_JavaObjSelect($autoit_cntl_id, $javaferret_obj_name = "", $javaferret_obj_role = "", $instance_num = 1)

_JavaObjValuesGet($autoit_cntl_id, $javaferret_obj_name = "", $javaferret_obj_role = "", $instance_num = 1, $get_last_capture = 0, $delimiter = "", $expand = 1, $scrolling = 1, $cleanup = 1, $max_scroll_times = 5, $scale = 2, $left_indent = 0, $top_indent = 0, $right_indent = 0, $bottom_indent = 0, $show_capture = 0)

_JavaObjDeselect($autoit_cntl_id, $javaferret_obj_name = "", $javaferret_obj_role = "", $instance_num = 1)

_JavaObjPropertyGet($autoit_cntl_id, $javaferret_obj_name = "", $javaferret_obj_role = "", $instance_num = 1, $property_name = "")

_JavaTableRowSelect($autoit_cntl_id, $javaferret_obj_name = "", $instance_num = 1, $javaferret_panel_name = "", $panel_instance_num = 1, $col_names = "", $col_values = "")

_JavaTableCellSelect($autoit_cntl_id, $javaferret_obj_name = "", $instance_num = 1, $javaferret_panel_name = "", $panel_instance_num = 1, $col_names = "", $col_values = "", $col_name_select = "")

_JavaTableCellValueGet($autoit_cntl_id, $javaferret_obj_name = "", $instance_num = 1, $javaferret_panel_name = "", $panel_instance_num = 1, $col_names = "", $col_values = "", $col_name_select = "")

_JavaTableCellValueSet($autoit_cntl_id, $javaferret_obj_name = "", $instance_num = 1, $javaferret_panel_name = "", $panel_instance_num = 1, $col_names = "", $col_values = "", $col_name_select = "", $object_value = "")

DEMONSTRATION:

<Under Construction>

EXAMPLES:

_JavaObjValueGet.au3

_JavaObjValueSet.au3_JavaObjValueSelect.au3

_JavaObjValuesGet.au3_JavaObjPropertyGet.au3

DOWNLOAD:

Latest Version - v0.7 (17/03/09)

AutoITJavaAccess.dllJava.au3

Edited October 5, 2009 by seangriffin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值