Jump to content
phamtua

Click to button without ID, Name, Value

Recommended Posts

Subz

Try something like:

#include <IE.au3>
Local $oButtons = _IETagNameGetCollection($oIE, "button")
For $oButton In $oButtons
    If $oButton.classname = "btn btn-success" Then
        _IEAction($oButton, "click")
        ExitLoop
    EndIf
;~ Or you could use InnerText
    If $oButton.InnerText = "Convert" Then
        _IEAction($oButton, "click")
        ExitLoop
    EndIf
Next

 

Share this post


Link to post
Share on other sites
phamtua

Worked, thanks!

Share this post


Link to post
Share on other sites
phamtua

@Subz If in a HTML Code, there are two buttons, how can I click it
P/s: 

$oButton.classname has two values!

Share this post


Link to post
Share on other sites
Subz

Do they both have the same inner text?  If not just use the second piece of code I posted in the example above which used InnerText property.

Share this post


Link to post
Share on other sites
phamtua

No, there are 2 buttons in a web, therefore

$oButton.classname <> "btn btn-success"

Share this post


Link to post
Share on other sites
Subz

Not sure you understand my previous question, do both buttons say "Convert" or are they different?  If they are different then you can just use:

#include <IE.au3>
Local $oButtons = _IETagNameGetCollection($oIE, "button")
For $oButton In $oButtons
    If $oButton.InnerText = "Convert" Then
        _IEAction($oButton, "click")
        ExitLoop
    EndIf
Next

 

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

×