Sign in to follow this  
Followers 0
brezenix

How to click button in IE without ID and Name

10 posts in this topic

Hello!

Help me, please.

I need to click a button on a web page, but it did not have any ID or Name.

Here is the code:

<button style="width: 110px;" onclick="doonsubmit()" type="submit">

Share this post


Link to post
Share on other sites



Check out manual -> UDF -> IE.

There might be some helpers for enumerating website buttons and inspecting their properties.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Check out manual -> UDF -> IE.

There might be some helpers for enumerating website buttons and inspecting their properties.

Naturally there I looked, there IEFormElementGetObjByName, but this button has no "Name" Edited by brezenix

Share this post


Link to post
Share on other sites

Naturally there I looked, there IEFormElementGetObjByName, but this button has no "Name"

Get all the elements with _IEFormElementGetCollection and loop through them until you find one whose .Type is "submit".

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Get all the elements with _IEFormElementGetCollection and loop through them until you find one whose .Type is "submit".

Like this?

$oButtons = _IETagNameGetCollection ($oIE, "button")
For $oButton In $oButtons
    If $oButton.type = "submit" Then    _IEAction ($oIE, "click")
Next

Share this post


Link to post
Share on other sites

Like this?

$oButtons = _IETagNameGetCollection ($oIE, "button")
 For $oButton In $oButtons
    If $oButton.type = "submit" Then    _IEAction ($oIE, "click")
 Next

Did you try it? Did it work?

I would replace _IETagNameGetCollection with _IEFormElementGetCollection though.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Did you try it? Did it work?

I would replace _IETagNameGetCollection with _IEFormElementGetCollection though.

No, I'm at home now and I not have Windows >_< I will try it on Monday at the work.

Share this post


Link to post
Share on other sites

This is work:

$oButtons = _IETagNameGetCollection ($oIE, "button")
 For $oButton In $oButtons
    If $oButton.type = "submit" Then _IEAction ($oButton, "click")
 Next

Share this post


Link to post
Share on other sites

Also you have to keep in mind that this will only click the first button in the collection.

If you have several buttons and you want to click not on the first button you have to think of something else to identify it.

Share this post


Link to post
Share on other sites

Also you have to keep in mind that this will only click the first button in the collection.

If you have several buttons and you want to click not on the first button you have to think of something else to identify it.

Thank you. I'm aware of. Fortunately there is only one button to "submit" >_<

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