Not working Send() and Mouse Click in window with Class:SunAwtFrame on third level

0

I try to automate procedures in my Oracle MiddleWare Environment and when I get to the bottom of it, where I should click "Run" button (in Cyrrilic), I can't do this with Send, or Control, or Mouse. However, it is third level of the submenu, all other levels work (I know the usual problems with Frames, but it works for other levels, than why?))

The summary from Info is below:

Window <<<< Title: My Window Class: SunAwtFrame Position: 0, 0 Size: 820, 660 Style: 0x16CF0000 ExStyle: 0x00000100 Handle: 0x00171058

Control <<<< Class:
Instance:
ClassnameNN:
Name:
Advanced (Class):
ID: Text:
Position:
Size:
ControlClick Coords:
Style:
ExStyle:
Handle: 0x000910F4

Mouse <<<< Position: 448, 427 Cursor ID: 0 Color: 0xC0FFFF

StatusBar <<<<

ToolsBar <<<<

Visible Text <<<<

Hidden Text <<<<

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")

Please note that I cannot change anything at all in Oracle MiddleWare environment or on the server side.

autoit
oracle-fusion-middleware
asked on Stack Overflow Jan 18, 2019 by Artem Kovalev

1 Answer

0

To answer this for your class SunAwtFrame the question is too unclear. But your code has some issues.

  1. _WinWaitActivate() with Sleep(15000) isn't necessary because you can use WinWaitActive($sTitle, $sText, $iTimeout) with a timeout of 15 seconds as third parameter.
  2. Your problem for the stopping should be the line 21. You can not add a new line within a function parameter without using of & _ at the end of the line. Use a function like _sendKeystrokesSeveralTimes() to avoid such long parameter values.
  3. You also could shorten your MouseMove() and then MouseClick() action by doing MouseClick('left', 268, 363) to the target mouse position.

Here a reworked version of your code:

#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)
answered on Stack Overflow Feb 5, 2019 by (unknown user) • edited Mar 11, 2019 by user4157124

User contributions licensed under CC BY-SA 3.0