Jump to content
zemkor

IE Click on button by Value

Recommended Posts

zemkor

Hello, i need your help again. How click on button in form if buttons have same name ? Button value is different. 

My script not working

func odoslat()
Local $oForm = _IEFormGetObjByName($oIE, "formedit")
Local $oSelect = _IEFormElementGetObjByName($oForm, "Zmazať")
_IEAction($oSelect, "focus")
_IEAction($oSelect, "click")
EndFunc

Source code from web is here: I need click on button "Zmazať"

<form name="formedit" id="formedit" method="post"  action="/deletei2.php">
<br>
Vaše heslo:<br> <input type="text" name="heslobazar" maxlength="20" value=""><br><br>
<input type="hidden" name="idad" id="idad" value=49359062>
<input type="submit" name="administrace" value="Editovať"> <input type="submit" name="administrace" value="Zmazať">
</form>
</td>
</tr>

Thanks for answer

Edited by zemkor

Share this post


Link to post
Share on other sites
Kyan

See if this works (don't know how should I test this xD), I only used IE udf one or three times...and I hate it

$oButtons = _IEGetObjByName($oForm,"administrace",-1)
For $oBtn In $oButtons
    If _IEFormElementGetValue($oBtn) = "Zmazat" Then
        _IEAction($oBtn, "focus")
        _IEAction($oBtn, "click")
        ExitLoop
    EndIf
Next
Edited by Kyan

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites
zemkor

Kyan Thanks you much, your solution working. :)

Share this post


Link to post
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

  • Similar Content

    • nooneclose
      By nooneclose
      Hello again, I am in phase two of my help bot. I cannot figure out how to properly code Autoit to click on a webpage button using the I.E UDF. I want to click on the button that I have attached as an image. This button does not have a name but it has an ID. Here is the HTML code for this button that I found using chromes developer inspector.
      HTML Code: 
      <img role="button" tabindex="-1" id="toolactions_INSERT-tbb_image" src="nav_icon_insertkey.gif" alt="New Work Order CTRL+ALT+I" draggable="false"> Here is the code that I have so far:
      ;******************************************************************************* ; Opens IE and fill out a New Workorder ;******************************************************************************* ; Start IE at the ** Tracking Application in ****** $oIE = _IECreate("https:I_am_Bound_by_my_company_to_not_reveal_this_webpage") ; Wait for a browser page load to complete _IELoadWait($oIE) Sleep(6000) ; Store the field names where the important data will be sent Local $nWorkOrderB = _IEGetObjById($oIE, "toolactions_INSERT-tbb_image") _IEAction($nWorkOrderB, "click")  I want my program to click on the button that looks like a piece of paper with a blue # 
      (For those wondering, I am allowed to send images just not the URL.) 
      As always any help would be appreciated. 

    • MJ36
      By MJ36

      How to click this button ? 
      I Try 
       
      func test () $oCorrectObj = "" $tags = $oIE.document.GetElementsByTagName("button") For $tag in $tags $class_value = $tag.GetAttribute("type") If string($class_value) = "buttont" Then $oCorrectObj = $tag MsgBox(0, "Level: ", "Level found :)") Else MsgBox(16, "Failed", "Not found.") ExitLoop EndIf Next If IsObj ( $oCorrectObj ) Then _IEAction ($oCorrectObj, "click") EndIF  
      and
       
      func klik () Local $oFound = "" Local $oBtns = _IETagNameGetCollection($oIE, "span") For $oBtn In $oBtns If String($oBtn.classname) = "yt-uix-button-content" Then $oFound = $oBtn EndIf Next _IEAction ($oFound, "click") EndFunc  
      Please Help 
      Can you click it by name?
    • faustf
      By faustf
      i guys , like title anyone  have idea if is possible , and if yes if  have example to post ?  i find in forum and in google but  i dont know   how can start  to create  button with icon over toolbar near  clock or is  goog before language layout .
      sorry i not post any script but i dont know  where to start
      thankz
      at  all
    • caramen
      By caramen
      Hmmm i am sorry  i had simular problem but i cant find back post. 
       
      How to hide a gui button ? 
       
      I Want to dodge the variable non déclaréd when i make button in
      if statment 
       
      thx before 
    • iamtech
      By iamtech
      i tried to print ie windows with my default printer  using
      _IEAction ($oIE, "printdefault") but it was not working sometimes, autoit icon showing in tray but not printing anything.
×