Jump to content

Please how can i click this button?


Recommended Posts

Hello again guys,

Ill try and make this quick as im my brains starting to melt, ive tried aloooot of combinations to try and click the following button, can som1 please just give me a quick few lines that will click the following? Thanks alot guys

<BUTTON class="action af_commandButton" onclick="submitForm('ManageUsers',1,{source:'_id106:_id133'});return false;" type=button>Assign</BUTTON>

 

Thanks again

Ant

Link to comment
Share on other sites

You can list all elements having these classes and click on the first button among this list.

OR: execute directly the submitForm js function (if possible).

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

Hello, I have tried the followings and nothing seems to work, this comes back positive as i get the Msgbox however it doesnt click the button :S any help apreciated,

thanks.

Also i know there is like 4 or 5 click commands in there that was just where i was trying lot sof different ways of clicking it but none seem to work.

Local $oFound = ""
Local $oBtns = _IETagNameGetCollection($oIE, "button")
For $oBtn In $oBtns
    If String($oBtn.classname) = "action af_commandButton" Then
     $oFound = $oBtn
  _IEAction($oFound, "click")
   EndIf
Next
If IsObj($oFound) Then
 $oFound.fireEvent("onmousedown")
$oFound.fireEvent("onmouseup")
_IEFormSubmit($oIE)
_IEFormSubmit($oFound)
_IEFormSubmit($oBtn)
MsgBox(16, "Success", "SCript works").
Exit
exit
Else
 MsgBox(16, "Failed", "Not found.")
 exit
EndIf
Edited by Annonyreeder
Link to comment
Share on other sites

oh thats not the problem, i know which button it is i want to click

<BUTTON class="action af_commandButton" onclick="submitForm('ManageUsers',1,{source:'_id106:_id133'});return false;" type=button>Assign</BUTTON>

 

This is the button i want to click above
And below are the buttons its getting mixed up with

 

<BUTTON id=userProfileForm:Userssave class="action af_commandButton" onclick="submitForm('ManageUsers',1,{source:'userProfileForm:Userssave'});return false;" name=userProfileForm:Userssave type=button>Save</BUTTON>
 
<BUTTON id=userProfileForm:UnassignSingleSelection class="action af_commandButton" onclick="submitForm('ManageUsers',0,{source:'userProfileForm:UnassignSingleSelection'});return false;" name=userProfileForm:UnassignSingleSelection type=button>Unassign</BUTTON>
 
<BUTTON id=userProfileForm:UsersundoAll class="action af_commandButton" onclick="submitForm('ManageUsers',0,{source:'userProfileForm:UsersundoAll'});return false;" name=userProfileForm:UsersundoAll type=button>Cancel</BUTTON>
 
<BUTTON id=usersSubform:Usersinsert class="action af_commandButton" onclick="submitForm('ManageUsers',1,{source:'usersSubform:Usersinsert'});return false;" name=usersSubform:Usersinsert type=button>Create</BUTTON>
 
<BUTTON id=usersSubform:selectButton class="action af_commandButton" onclick="submitForm('ManageUsers',1,{source:'usersSubform:selectButton'});return false;" name=usersSubform:selectButton type=button>Select</BUTTON>
 

 

As you can see they are very different however i just don't know how to direct my script towards the button i need, Ive tried Clicklinkbytext($XX, "Assign"), i had a feeling it wouldn't work as its a button not a link, is there any similar commands to this that would work with a button? ive allso tried changing .Classname to .onclick = "xxx", but also that did not work,

Thanks

Ant

Link to comment
Share on other sites

You need to be able to programmatically determine the desire button. That was my point... loop through the matching buttons until you find the one with the desired onClick functionality.

I notice that the other buttons each have an assigned ID. You might be able to just search for the one without a value for the ID. Also, you could just look for the button with value of "Assign".

Link to comment
Share on other sites

Ahh ok thanks, but how do i have it loop through checking the onClick, i know how to make it look for Button class but when i change .classname to .onclick it comes up with "nothing found", also when i set it to look for 0 value again nothing is found, examples below

global $oIE
$sUrl = "https://apply.eidverifier.net/uru/connect/SecurityAdmin/ManageUsers.faces"
    $oIE = _IEAttach($sUrl, "url")
$o_form = _IEFormGetObjByName($oIE, "ManageUsers")

$oLinks = _IELinkGetCollection($o_form, 2)
Local $oFound = ""
Local $oBtns = _IETagNameGetCollection($o_form, "Button")
For $oBtn In $oBtns
    If String($oBtn.value) = "" Then
     $oFound = $oBtn
   EndIf
Next
If IsObj($oFound) Then
_IEAction($oFound, "click")
 MsgBox(16, "Success", "Password23 with a captial P (Roles have been set)")
Exit
exit
Else
 MsgBox(16, "Failed", "Not found.")
 exit
EndIf
Local $oFound = ""
Local $oBtns = _IETagNameGetCollection($form5, "Button")
For $oBtn In $oBtns
    If String($oBtn.onclick) = "submitForm('ManageUsers',1,{source:'_id106:_id133'});return false;" Then
     $oFound = $oBtn
   EndIf
Next
If IsObj($oFound) Then
 $oFound.fireEvent("onmousedown")
$oFound.fireEvent("onmouseup")
_IEFormSubmit($oIE)
_IEFormSubmit($oFound)
_IEFormSubmit($oBtn)
 MsgBox(16, "Success", "Password23 with a captial P (Roles have been set)")
Exit
exit
Else
 MsgBox(16, "Failed", "Not found.")
 exit
EndIf

global $oIE
$sUrl = "https://apply.eidverifier.net/uru/connect/SecurityAdmin/ManageUsers.faces"
    $oIE = _IEAttach($sUrl, "url")
$o_form = _IEFormGetObjByName($oIE, "ManageUsers")

$oLinks = _IELinkGetCollection($o_form, 2)
Local $oFound = ""
Local $oBtns = _IETagNameGetCollection($o_form, "Button")
For $oBtn In $oBtns
    If String($oBtn.Value) = "Assign" Then
     $oFound = $oBtn
   EndIf
Next
If IsObj($oFound) Then
_IEAction($oFound, "click")
 MsgBox(16, "Success", "Password23 with a captial P (Roles have been set)")
Exit
exit
Else
 MsgBox(16, "Failed", "Not found.")
 exit
EndIf
 

 

Thanks for help

Ant

Edited by Annonyreeder
Link to comment
Share on other sites

Use .outerHtml instead of .onClick and then parse the result to identify the desired button.

Did you try this?:

For $oBtn In $oBtns
    If $oBtn.classname = "action af_commandButton" And $oBtn.id = "" Then
        $oFound = $oBtn
        _IEAction($oFound, "click")
        ExitLoop
    EndIf
Next
Link to comment
Share on other sites

Hey, just relised i forgot to post my results, i did manage to get this working using the following code

$o_form5 = _IEFormGetObjByName($oIE, "ManageUsers")
$valueToSearch="Assign"
$oInputs = _IETagNameGetCollection ($o_form5, "Button")
For $oInput In $oInputs
    $thePropertyValue=$oInput.outerHtml
    If StringInStr($thePropertyValue, $valueToSearch) > 0 Then
        $oInput.FireEvent("onclick")
  endif

 

Thanks for your help on this guys the projects turned out perfect :)

Ant

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...