Jump to content
Sign in to follow this  
BitByteBit

IE Help, need to click a link with a changing name

Recommended Posts

BitByteBit

I have a webpage, I want to click a link on this page, I can't use _IeClickLinkByText, I tried _IEFormGetCollection with no success. Also tried _IELinkGetCollection.

The problem is that the name of the button is different each time.

How do I click a link, by searching for its value, instead of looking for its name or ID?

I've been staring at the help file section about the IE commands for quite a while now and still not turned up anything, so I decided to submit and ask for help.

<div class="buttons"><br/>
<input type="hidden" id="params[from_id]" name="params[from_id]" value="1521754579" autocomplete="off" />
<input type="hidden" id="params[app_id]" name="params[app_id]" value="102452128776" autocomplete="off" />
<input type="hidden" id="params[req_type]" name="params[req_type]" value="0" autocomplete="off" />
<input type="hidden" id="params[is_invite]" name="params[is_invite]" value="0" autocomplete="off" />
<input type="submit" value="Accept" name="actions[http://ThisIsDifferentEachTime]" class="inputbutton" />
<input type="submit" value="Ignore" name="actions[reject]" class="inputbutton" />

<input type="submit" value="Accept" name="actions[http://ThisIsDifferentEachTime]" class="inputbutton" />

Is what I need to click.

Thanks for your time.

Share this post


Link to post
Share on other sites
Juvigy

Check out the IE udf examples.

_IEGetObjByName + _IEAction(element / click)

Should do the trick in most cases

Share this post


Link to post
Share on other sites
BitByteBit

Oops, forgot to mention I tried that, but like I said, the name is name="actions[http://ThisIsDifferentEachTime.com/XYZ]"

Any ideas?

I guessed I need to search for the Value since this is the only constant.

Share this post


Link to post
Share on other sites
Juvigy

You can identify it by its value then - value="Accept".

#include <IE.au3>
$oIE = _IEAttach ("sometihn")
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
    If $oInput.value="Accept" then _IEAction($oInput,"click")
Next

Mind if the page have iframes and other tricky stuff like Java.

Share this post


Link to post
Share on other sites
BitByteBit

Resolved, exactly what I needed, thanks a lot! +

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.