dustintt Posted September 24, 2009 Share Posted September 24, 2009 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 Link to comment Share on other sites More sharing options...
jvanegmond Posted September 24, 2009 Share Posted September 24, 2009 _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. github.com/jvanegmond Link to comment Share on other sites More sharing options...
dustintt Posted September 24, 2009 Author Share Posted September 24, 2009 _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? Link to comment Share on other sites More sharing options...
jvanegmond Posted September 24, 2009 Share Posted September 24, 2009 Sorry, apart from giving it a name, I don't really have any suggestions. P.S. Actually, I do. Try _IENavigate($oIE, "javascript:backupClick()") github.com/jvanegmond Link to comment Share on other sites More sharing options...
Juvigy Posted September 24, 2009 Share Posted September 24, 2009 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 Link to comment Share on other sites More sharing options...
dustintt Posted September 24, 2009 Author Share Posted September 24, 2009 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 Link to comment Share on other sites More sharing options...
dustintt Posted September 24, 2009 Author Share Posted September 24, 2009 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 Link to comment Share on other sites More sharing options...
jvanegmond Posted September 24, 2009 Share Posted September 24, 2009 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. github.com/jvanegmond Link to comment Share on other sites More sharing options...
dustintt Posted September 24, 2009 Author Share Posted September 24, 2009 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 Link to comment Share on other sites More sharing options...
dustintt Posted September 24, 2009 Author Share Posted September 24, 2009 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 Link to comment Share on other sites More sharing options...
jvanegmond Posted September 24, 2009 Share Posted September 24, 2009 I have no more ideas that can help you. Sorry. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now