Jump to content

Recommended Posts

Hi. I can not automate the click at a button, because there are three of them exactly in the source page.

Imagine you have this html source code:

<div class="submit"><span class="button btnDefault"><span><input type="submit" value="Search" /></span></span></div>

How could I select just one element, and do click as an action on it?

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']")

_WD_ElementAction($sSession, $sElement, 'click')

That just do not work.

Any ideas?

submits.PNG

Link to post
Share on other sites

You can get an array of submit elements then access to correct one in the array.

 

Saludos

Link to post
Share on other sites
31 minutes ago, Danyfirex said:

You can get an array of submit elements then access to correct one in the array.

 

Saludos

Gracias Danyfirex, I think I understand what you mean but I do not know how to code it

I have tried to do this:

Local $aVar[3]
    _ArrayAdd ($aVar,_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']"))
    _ArrayAdd ($aVar,_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']"))
    _ArrayAdd ($aVar,_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']"))

    MsgBox($MB_SYSTEMMODAL, "FINaaa", $aVar[2] )
    _WD_ElementAction($sSession, $aVar[2], 'click')

but with out result.

Link to post
Share on other sites

I meant this:

Local $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit'][@value='Search']","",True)
_ArrayDisplay($aElements)

Saludos

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By izmegna
      I am trying to auto login to web app that has the following HTML for the username, password and submit button:
      USERNAME:
      <input name="usernameField" tabindex="0" class="inp" id="usernameField" type="text" value="" message="FND_SSO_USER_NAME">
      Password:
      <input name="passwordField" tabindex="0" class="inp" id="passwordField" type="password" value="" message="FND_SSO_PASSWORD">
      Login:
      <button tabindex="0" class="OraButton left" style="padding-right: 6px; padding-left: 6px;" onclick="submitCredentials()" message="FND_SSO_LOGIN">Log In</button>
      Following is the AutoIT script I am using I am passing the username and password via cmd but it is not working, any suggestion?
       
      #include <IE.au3>
      Local $url ="https://www.Intra.edwa.com"
      Local $oIE =_IECreate($url)
      _IELoadWait($oIE)
      Local $oUser =_IEGetObjById($oIE,"usernameField")
      Local $oPass =_IEGetObjById($oIE,"passwordField")
      _IEFormElementSetValue($oUser, $CmdLine[1])
      _IEFormElementSetValue($oPass, $CmdLine[2])
      _IELoadWait($oIE)
      $oLinks = _IETagNameGetCollection($oIE, "input")
      For $oLink In $oLinks
          If String($oLink.type) = "submit" And String($oLink.value) = "Sign In" Then
                _IEAction($oLink, "click")
                ExitLoop
          EndIf
      Next
    • By XinYoung
      Hello again 
      I need to click this Submit button, but it's in a lightbox and has no ID (i think) and I can't figure out a way to target it. _IEFormSubmit doesn't work.

       
      Thank you
    • By jasontj
      Hello.  I'm working on converting another script from IE to Firefox.  I can't seem to get a handle on the field "Defendant" to fill in a last, first name on this page:
      http://www.hcdistrictclerk.com/Edocs/Public/Search.aspx?Tab=tabCriminal
      I also can't seem to submit the form.   I've tried the code below... stuff may be commented out that I have tested.
       
          _FFOpenUrl("http://www.hcdistrictclerk.com/Edocs/Public/Search.aspx?Tab=tabCriminal")    
          _FFLoadWait()
          $oTextFN = _FSObjGet("ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_tabSearch_tabCriminal_txtCrimDefendant", "ID")
          
          _FFObj($oTextFN, "value", "Smith, John")    
          $subButton = _FFObjGet("ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$btnSearch", "name")
          _FFClick($subButton)
          _FFLoadWait()
          
      ;    _FFFormSubmit()
      ;    _FFLoadWait()
       
      Any help from the experts on here would be greatly appreciated.  
       
      Jason
       
       
       
       
    • By dadalt95
      Perform a simple google search!
      The script below works fine until fill the google form!
      What I can't find is how to submit the form, tried a couple of ways and none of them worked.

       
      #include <IE.au3> $oIE = _IECreate ("www.google.com") $o_form = _IEFormGetObjByName ($oIE, "f") $o_login = _IEFormElementGetObjByName ($o_form, "q") $username = "80251369" _IEFormElementSetValue ($o_login, $username) $o_numer = _IEGetObjByName($o_form, "btnK") _IEAction ($o_numer, "click")  
      The code runs without any problem.
      I don't know how to proceed!
      Thanks in advance!
    • By boy233
      Hello, 
      How do I select the submit?
      Anybody know?!
      <form method="post" action="register.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1"> .... .... <input type="submit" name="btnConfirm" value="Confirm" id="btnConfirm" disabled="disabled" class="aspNetDisabled Button" /> &nbsp;&nbsp; .... .... <input type="submit" name="btnQuery" value="Query" id="btnQuery" disabled="disabled" class="aspNetDisabled Button" /> &nbsp;&nbsp; </form>  
×
×
  • Create New...