Jump to content
Sign in to follow this  
brezenix

How to click button in IE without ID and Name

Recommended Posts

brezenix

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
amokoura

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
brezenix

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
Skruge

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
brezenix

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
Skruge

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
brezenix

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
brezenix

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
Juvigy

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
brezenix

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.