不工作Send()和鼠标在窗口中单击Class:SunAwtFrame在第三级

问题描述 投票:0回答:1

我尝试在Oracle MiddleWare环境中自动执行程序,当我到达底部时,我应该单击“运行”按钮(在Cyrrilic中),我无法使用Send,Control或Mouse执行此操作。但是,它是子菜单的第三级,所有其他级别都有效(我知道Frames的常见问题,但它适用于其他级别,而不是为什么?))

Info的摘要如下:

窗口<<<<标题:我的窗口类:SunAwtFrame位置:0,0大小:820,660样式:0x16CF0000 ExStyle:0x00000100句柄:0x00171058

控制<<<<类: 例如: ClassnameNN: 名称: 高级(班级): ID:文字: 位置: 尺寸: ControlClick Coords: 样式: 扩展风格: 句柄:0x000910F4

鼠标<<<<位置:448,427光标ID:0颜色:0xC0FFFF

StatusBar <<<<

工具栏<<<<

可见文字<<<<

隐藏文字<<<<

Local $sLogin = InputBox("Security Check", "Enter your login", "")
Local $sPasswd = InputBox("Security Check", "Enter your password.", "","-")

$oIE = _IECreate("https://******************",0,0,1,1)
$oLinks = _IETagNameGetCollection($oIE, "input")
For $oLink In $oLinks
If String($oLink.type) = "button" And String($oLink.value) = "RUN" Then
      _IEAction($oLink, "click")
      ExitLoop
EndIf
Next
_IELoadWait($oIE, 1000)
Sleep(15000)
_WinWaitActivate("Oracle Fusion Middleware Forms Services","")
Send($sLogin)
Send("{TAB}")
Send($sPasswd)
Send("{TAB}")
Send("{SHIFTDOWN}prod{SHIFTUP}9{ENTER}")
_WinWaitActivate("My Window","")
Send("{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN} 
{DOWN}{UP}{RIGHT}{DOWN}{DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}{RIGHT}{DOWN} 
{DOWN}{DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")
        *//And here it stops working without any error.//       
Send("03/01/2019")
Send("{TAB}{TAB}{TAB}")
MouseMove(268,363,25)
MouseClick("primary")

请注意,我无法在Oracle MiddleWare环境或服务器端更改任何内容。

autoit oracle-fusion-middleware
1个回答
0
投票

要为你的班级SunAwtFrame回答这个问题,这个问题太不清楚了。但是你的代码存在一些问题。

  1. _WinWaitActivate()Sleep(15000)不是必需的,因为你可以使用WinWaitActive($sTitle, $sText, $iTimeout)超时15秒作为第三个参数。
  2. 您停止的问题应该是第21行。您不能在函数参数中添加新行而不使用行末尾的& _。使用像_sendKeystrokesSeveralTimes()这样的函数来避免这么长的参数值。
  3. 你也可以通过将MouseMove()放到目标鼠标位置来缩短你的MouseClick()然后MouseClick('left', 268, 363)动作。

这是您的代码的重写版本:

#include-once
#include <IE.au3>

Global $sLogin  = InputBox('Security Check', 'Enter your login', '')
Global $sPasswd = InputBox('Security Check', 'Enter your password.', '', '-')
Global $oIE     = _IECreate('https://******************', 0, 0, 1, 1)
Global $oLinks  = _IETagNameGetCollection($oIE, 'input')

Func _clickButtonRun()
    For $oLink In $oLinks
        If String($oLink.type) == 'button' And String($oLink.value) == 'RUN' Then
            _IEAction($oLink, 'click')
            ExitLoop
        EndIf
    Next
EndFunc

Func _sendKeystrokesSeveralTimes($sKey, $iHowOften = 1)
    For $i = 1 To $iHowOften Step 1
        Send($sKey)
        Sleep(200) ; to increase the robustness wait a bit between each input/send
    Next
EndFunc

_clickButtonRun()
_IELoadWait($oIE, 1000)
WinWaitActive('Oracle Fusion Middleware Forms Services', '', 15)
_sendKeystrokesSeveralTimes($sLogin)
_sendKeystrokesSeveralTimes('{TAB}')
_sendKeystrokesSeveralTimes($sPasswd)
_sendKeystrokesSeveralTimes('{TAB}')
_sendKeystrokesSeveralTimes('PROD9')
_sendKeystrokesSeveralTimes('{ENTER}')
WinWaitActive('My Window', '', 5)
_sendKeystrokesSeveralTimes('{TAB}')
_sendKeystrokesSeveralTimes('{DOWN}', 11)
_sendKeystrokesSeveralTimes('{UP}')
_sendKeystrokesSeveralTimes('{RIGHT}')
_sendKeystrokesSeveralTimes('{DOWN}', 4)
_sendKeystrokesSeveralTimes('{RIGHT}')
_sendKeystrokesSeveralTimes('{DOWN}', 2)
_sendKeystrokesSeveralTimes('{RIGHT}')
_sendKeystrokesSeveralTimes('{DOWN}', 5)
_sendKeystrokesSeveralTimes('{RIGHT}')
_sendKeystrokesSeveralTimes('{DOWN}', 4)
_sendKeystrokesSeveralTimes('{ENTER}')
_sendKeystrokesSeveralTimes('03/01/2019')
_sendKeystrokesSeveralTimes('{TAB}', 3)
MouseClick('left', 268, 363)
© www.soinside.com 2019 - 2024. All rights reserved.