Sign in to follow this  
Followers 0
dustintt

Unable to click an IE button

11 posts in this topic

Hi,

I have been trying out AutoIT for a few weeks and now I have come accross a case where I need some assistance:

I can log into my router and navigate to the relevent page, but I cannot click the Backup Settings button.

If I Tab around the page, sometimes it works and sometimes the Tab ends up in a different location, so I would like to use an alternative method.

I have tried the AutoIT Window Info tool and even when I used the Advanced Class name it still did not work.

Here is the code that I am now trying to use instead of Tabing around:

Code:

$oIE = _IECreate("http://routerurl.html")
$oButton = _IEGetObjByName($oIE, "Backup Settings")
_IEAction($oButton, "click")

Page HTML:

<BLOCKQUOTE>

<FORM><B>Settings -- Backup Settings</B><BR><BR>Backup DSL Router configurations. You may save your router configurations to a file on your PC.<BR><BR><BR>

<P align=center><INPUT onclick=backupClick() value="Backup Settings" type=button></P></FORM></BLOCKQUOTE>

Console Error:

--> IE.au3 V2.4-0 Warning from function _IEGetObjByName, $_IEStatus_NoMatch (Name: Backup Settings, Index: 0)

--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType

Can someone help me click this button and also tell me what I am doing wrong?

Thanks in advance,

DR

Share this post


Link to post
Share on other sites



_IEGetObjByName gets an object by name. The object it tries to get must have the name attribute defined. For example:

<a name="lolwut">

You can then get it with _IEGetObjByName($oIE, "lolwut") and you have your object.

Share this post


Link to post
Share on other sites

_IEGetObjByName gets an object by name. The object it tries to get must have the name attribute defined. For example:

<a name="lolwut">

You can then get it with _IEGetObjByName($oIE, "lolwut") and you have your object.

Thanks Manadar.

That explains what I am doing wrong.

Any suggestions for clicking the button?

Share this post


Link to post
Share on other sites

Sorry, apart from giving it a name, I don't really have any suggestions.

P.S. Actually, I do. Try _IENavigate($oIE, "javascript:backupClick()")

Share this post


Link to post
Share on other sites

Check out this example:

It will click on every "input" on that page.

#include <IE.au3>
$oIE = _IECreate("http://routerurl.html")
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
   _IEAcion($oInput,"click")
Next

Share this post


Link to post
Share on other sites

Sorry, apart from giving it a name, I don't really have any suggestions.

P.S. Actually, I do. Try _IENavigate($oIE, "javascript:backupClick()")

Thanks Manadar,

That helped, but got the Internet Explorer script protection popup (see attached).

Dustin

post-53134-12538062289287_thumb.jpg

Share this post


Link to post
Share on other sites

Check out this example:

It will click on every "input" on that page.

#include <IE.au3>
$oIE = _IECreate("http://routerurl.html")
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
   _IEAcion($oInput,"click")
Next

Thanks Juvigy,

That worked as well, but also gave the IE script protection popup that Manadar's solution did. If there is no other way to click the button without getting the script popup then I will try to work around it.

DR

Share this post


Link to post
Share on other sites

If this is just for yourself (I see routerurl and invalid HTML) you can adjust the security settings of Internet Explorer. You can add your router website as an exception, so it has more priviledges.

Share this post


Link to post
Share on other sites

If this is just for yourself (I see routerurl and invalid HTML) you can adjust the security settings of Internet Explorer. You can add your router website as an exception, so it has more priviledges.

Manadar,

Actually I want to give this out after making an exe.

DR

Share this post


Link to post
Share on other sites

If this is just for yourself (I see routerurl and invalid HTML) you can adjust the security settings of Internet Explorer. You can add your router website as an exception, so it has more priviledges.

Manadar,

If I revert to using my Tabing solution which Tabs 8 times before it reaches the button, any idea why sometimes it will correctly stop on the button and sometimes it will end up on some other control?

DR

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