Sign in to follow this  
Followers 0
dar100111

Clicking on a web tag with _ieaction

4 posts in this topic

#1 ·  Posted (edited)

Hi Everyone. 
  
I used the script below on a webpage I need to click a button on. It went through a ton of message boxes until it found the button I'm looking for.

Tagname: BUTTON

innerText:Go

   
 
 $oElements = _IETagNameAllGetCollection($oIE)
For $oElement In $oElements
MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
Next
 

I'm not sure how to save the tag as a variable, let's call it $tag, so that I can _ieAction($tag, "click") to click on this button.  Since it didn't have an ID I had to resort to this.  Does anyone have any knowledge on the syntax for this?  I'm just not sure how to tell it to save the exact tag on the webpage to my $tag.

Attached a screenshot

Thank you very much!
 

post-79874-0-92434900-1372887307_thumb.p

Edited by dar100111

Share this post


Link to post
Share on other sites



What does the HTML look like for the desired element?

Even if you had to loop through all of the elements until you found the one you wanted, you should be able to do something like this:

$oElements = _IETagNameAllGetCollection($oIE)
For $oElement In $oElements
  If $oElement.tagname = "BUTTON" And $oElement.innerText = "Go" Then
    _IEAction($oElement, "click")
    ExitLoop
  Endif
Next

Share this post


Link to post
Share on other sites

; Get a collection of all BUTTON objects
$oButtons = _IETagNameGetCollection($oIE, "BUTTON")
; Loop through each element in the collection
For $oButton In $oButtons
    ; check for an element with an innerText "Go"
    If String($oButton.innerText) = "Go" Then
        ; Save the current element to a variable
        $oButton2Save = $oButton
        ; Exit the for loop now that we have found the go button
        ExitLoop
    EndIf
Next

Share this post


Link to post
Share on other sites

Man you guys rock.  That worked.  Saved me a lot of headache here!

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
Sign in to follow this  
Followers 0