Jump to content

How to click on form button in a frame Page ???


ra95
 Share

Recommended Posts

Hi, i don't understand how to do' this.

I have a page with 2 frame and 1 body, in the left I have a Menu and in the right the body of page.

When the form and button are in the body i don't have problem to inviduate a buttun and costruct a script for click on, but if the button is in the left frame(menu) i can't know how to.

Anyone can help me.

Thx.

Antonio

my button in attach image.

(sorry but image posting no wortk now) :)

post-36477-12553521968503_thumb.png

Link to comment
Share on other sites

Did you get a reference to the parent frame first, or what? Show the code you used to try and drill down to a reference in the Frame and Form. Add _IEErrorHandlerRegister() and run it from SciTE to see the output to the console.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
    if $oInput.Value="richiste activazione" then _IEAction($oInput,"click")
Next

Something like this should work.

I don't think that will work without drilling down into the Frame first, at least (maybe into the Form also). But the OP doesn't show any code or explanation of how the attempt was made.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hi, gui sorry for wait, i'm out of city yesterday.

Now i have individuated a link of page button and have a link of body.

I Use a IE embedded for script.

Global $urlgo = "https://intra.eutelia.it/cgi-bin/wbc_webprovisioning"
Global $urlbott = "https://intra.eutelia.it/cgi-bin/wbc_webprovisioning1"; url of botton menu on sx side

$Formx = GUICreate("EUTELIA - "&$username&" - Pannello ADMIN", 500, 200, -1,-1,BitOr($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_EX_LAYERED)); Creo Finestra
$oIE = _IECreateEmbedded(); Definisco oggetto integrato funzionalita' IE
$IEGUI = GUICtrlCreateObj   ($oIE, 0, 0, 499, 199);Dimensioni dell'oggetto
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS);Possibilità di ridimensionare
GUISetState();Visibilità o no della finestra
AutoItSetOption("WinTitleMatchMode", 4); Controllo Finestra basandomi su titolo
$handle = WinGetHandle("EUTELIA - "&$username&" - Pannello ADMIN","")

Login(); this func is ok
Chkframeset(); I have use for individuate a number and tipe of frame ( result is  Page contains 2 frames in a FrameSet)
test()
proviamo()


Func ChkFrameset()
$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
If $iNumFrames > 0 Then
    If _IEIsFrameSet ($oIE) Then
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " frames in a FrameSet")
    Else
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " iFrames")
    EndIf
Else
    MsgBox(0, "Frame Info", "Page contains no frames")
EndIf
EndFunc

Func test()
_IENavigate ($oIE, $urlbott,"");va alla pagina della login Eutelia
_IELoadWait($oIE,50,7000);Tempo di attesa caricamento delle pagine IE max 5 sec.
$colForms = _IEFormGetCollection($oIE)
$iFormCnt = @extended
$iForm = 0
$sMsg = "Element values:" & @CRLF
For $oForm In $colForms
    $colElem = _IEFormElementGetCollection($oForm)
    $iElemCnt = @extended
   
    $iElem = 0
    For $oElem In $colElem
        $sMsg &= "Form " & $iForm & ": Elem " & $iElem & ":  " & _IEFormElementGetValue($oElem) & @CRLF
        $iElem += 1
    Next
   
    $iForm += 1
Next
ClipPut($sMsg)
;My result is:
;Element values:
;Form 11: Elem 0:  Dettaglio via EMAIL
;Form 12: Elem 0:  Trouble Shooting
;Form 13: Elem 0:  Trasf. ch. Postpagato
;Form 13: Elem 1:  voippost
;Form 14: Elem 0:  Gestione Barring
;Form 14: Elem 1:  voippost
;Form 15: Elem 0:  Oscuramento CLI
;Form 15: Elem 1:  voipall
;Form 16: Elem 0:  Attivazione
;(I have removed some line) :-)
;Form 30: Elem 1:  Numeri Portati

$oForms = _IEFormGetCollection ($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page"); result there are 31 form in this page
For $oForm In $oForms
    MsgBox(0, "Form Info", $oForm.name); my result always 0
Next
_IEAction($oIE,"back")
EndFunc

; I have try to do this but i think it's all wrong.
Func Proviamo()
$oForm = _IEFormGetCollection ($oIe,"Eutelia S.p.A. - Area reseller")
$oQuery = _IEFormElementGetCollection ($oForm, "Trasf. ch. Postpagato")
_IEAction($oQuery, "focus")
_IEAction($oQuery, "click")
EndFunc

Scite result is:

--> IE.au3 V2.4-0 Warning from function _IEFormGetCollection, $_IEStatus_NoMatch

--> IE.au3 V2.4-0 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType

I don't think this is a right mode to do wath i want do.

I have find some exaple

now i have tryed to do:

$oFrames = _IEFrameGetCollection ($oIE,0)

I obtain a frame collection without change the page ( i think is a goob mode i' dont know if is right)

Now i want click a button ... :-)

Thank for All help.

Ra95

Edited by ra95
Link to comment
Share on other sites

To drill down into the frame before getting the form would be more like this:

Func test()
    _IENavigate($oIE, $urlbott, "")
    _IELoadWait($oIE, 50, 7000)
    $oFrame = _IEFrameGetCollection($oIE, 0) ; Get first frame
    $colForms = _IEFormGetCollection($oFrame) ; Get forms from inside frame
    
    ; ...
    
EndFunc   ;==>test

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

To drill down into the frame before getting the form would be more like this:

Func test()
    _IENavigate($oIE, $urlbott, "")
    _IELoadWait($oIE, 50, 7000)
    $oFrame = _IEFrameGetCollection($oIE, 0) ; Get first frame
    $colForms = _IEFormGetCollection($oFrame) ; Get forms from inside frame
    
    ; ...
    
EndFunc   ;==>test

:)

Hi, I have insert a script line in a test function, but ulrbott is a link of frame 0 (button page frame) not a body.

I think the correct fun is:

I'm in a primary link. "frame 1"

Func test()
$oFrame = _IEFrameGetCollection($oIE, 0) ; Get first frame
$colForms = _IEFormGetCollection($oFrame) ; Get forms from inside frame

;Now i think must select a specific form (Trasf. ch. Prepagato) because a form 13 are 2 element 0 and 1 .
;remember
;Form 12: Elem 0:  Trouble Shooting
;Form 13: Elem 0:  Trasf. ch. Postpagato
;Form 13: Elem 1:  voippost
;Form 14: Elem 0:  Gestione Barring

$colElem = _IEFormElementGetCollection($colForms,13)
$Ftrasf = _IEFormElementGetObjByName($colElem,"Trasf. ch. Postpagato")
_IEAction($Ftrasf,"Click")

I have tryed but not work.

Why?? thx for all help.

Edited by ra95
Link to comment
Share on other sites

I don't know if you got the correct frame reference in the first place, since you seem to imply you wanted index = 1 vice 0. Change the index in _IEFrameGetCollection() if you didn't want 0.

Assuming that was correct(ed), then you didn't identify the form you wanted. You are trying to get a certain element (index = 13) from the collection of all forms vice a particular form. Provide the index to the form you want (0 = first form) in _IEFormGetCollection().

Your english is hard to follow, but I don't think you understand how the index parameters are being used:

This gets a reference to the first frame (index = 0):

$oFrame = _IEFrameGetCollection($oIE, 0)

This gets a collection of all forms in that frame (index = -1 by default):

$colForms = _IEFormGetCollection($oFrame)

** Note that since that is not a reference to a single frame, $colForms cannot be used directly to get elements from it.

** If you meant to get the first form, it should be index = 0: $oForm = _IEFormGetCollection($oFrame, 0)

This gets the 14th element from a form (index = 13):

$oElem = _IEFormElementGetCollection($oForm,13)

** Note that I changed the variable names because they are references to a single object, not collections.

I haven't the slightest idea what this is trying to do...:

$Ftrasf = _IEFormElementGetObjByName($colElem,"Trasf. ch. Postpagato")

** Perhaps you mean to get a child element of the previous element, but I doubt the name is "Trasf. ch. Postpagato". That's more likely the innertext of an element than a name.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hi, PsaltyDS

sorry for my poor english... :)

thanks for your patience,your example and explanations

This func. Work fine for me.!!!!

Func Trasfch()
$oFrame = _IEFrameGetCollection($oIE, 0)
$colForms = _IEFormGetCollection($oFrame)
$iFormCnt = @extended
$iForm = 0
For $oForm In $colForms
    $colElem = _IEFormElementGetCollection($oForm)
    $iElemCnt = @extended
   
    $iElem = 0
    For $oElem In $colElem
IF _IEFormElementGetValue($oElem) = "Trasf. ch. Postpagato" Then
    _IEFormSubmit ($oForm)
_IELoadwait($oIE)
EndIf
        $iElem += 1
    Next
$iForm += 1
Next
EndFunc

Thx

Ra95

Edited by ra95
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...