IndyUK Posted September 29, 2008 Share Posted September 29, 2008 Hi all, I'm trying to click an option that appears in a table definition but can't work out how to reference it. Here's the code.. <TABLE style="LEFT: 10px; POSITION: absolute; TOP: 102px"> <TBODY> <TR> <TD><A class=ITSMenuAnchor id=anchor1 href=' java script:Submit("../Payments/IntranetPayments.aspx", "../Common/"); '>Card Payments </A></TD></TR> <TR> <TD><A class=ITSMenuAnchor id=anchor2 href=' java script:Submit("../Reporting/SelectReport.aspx", "../Common/"); '>Reporting </A></TD></TR> <TR> <TD><A class=ITSMenuAnchor id=anchor9 href=' java script:Submit("../Suspense/EditSuspenseTran.aspx", "../Common/"); '>Suspended Transactions </A></TD></TR></TBODY></TABLE> <TABLE style="LEFT: 260px; POSITION: absolute; TOP: 100px"> <TBODY> <TR> <TD class=SmallBoldCompanyText>Welcome to Online Services</TD></TR></TBODY></TABLE> I'm trying the following code but it not working.. $oTable = _IEGetObjByname($oForm,"Card Payments") _IEAction($oTable, "click") The error I'm getting is.. --> IE.au3 V2.4-0 Warning from function _IEGetObjByName, $_IEStatus_NoMatch (Name: Card Payments, Index: 0) --> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType I'd appreciate any help with this. Thanks Link to comment Share on other sites More sharing options...
bluelamp Posted September 29, 2008 Share Posted September 29, 2008 (edited) try this: $oTable = _IEGetObjById ($oForm, "anchor1") _IEAction($oTable, "click") Edited September 29, 2008 by bluelamp Link to comment Share on other sites More sharing options...
IndyUK Posted September 29, 2008 Author Share Posted September 29, 2008 Hi bluelamp.. I tried your first example and got the following error.. --> IE.au3 V2.4-0 Warning from function _IEGetObjById, $_IEStatus_NoMatch (anchor1) --> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType The second example gave me the following.. --> IE.au3 V2.4-0 Warning from function _IELinkClickByText, $_IEStatus_NoMatch Any ideas? Link to comment Share on other sites More sharing options...
bluelamp Posted September 29, 2008 Share Posted September 29, 2008 share you complete script please Link to comment Share on other sites More sharing options...
IndyUK Posted September 29, 2008 Author Share Posted September 29, 2008 Here's my script so far. I've put "*" in place of logins and password etc.. for obvious reasons #NoTrayIcon #include <IE.au3> $oIE = _IECreate ("http://*****/*****.net/common/", 0) $Handle=WinGetHandle ("[CLASS:IEFrame]","") $Title = WinGetTitle($oIE) if WinActive($Title) Then WinActivate($Title); $oForm = _IEFormGetObjByName ($oIE,"Logon") $oLogin = _IEFormElementGetObjByName($oForm, "Name") $oPwd = _IEFormElementGetObjByName ($oForm, "Password") _IEFormElementSetValue($oLogin,"*****") _IEFormElementSetValue($oPwd, "*****") ;_IEFormSubmit ($oForm) $oSubmit = _IEGetObjByName($oIE, "LogonButton") _IEAction($oSubmit, "click") Else MsgBox(16,"Page Error","Error - Page not found") EndIf Link to comment Share on other sites More sharing options...
bluelamp Posted September 29, 2008 Share Posted September 29, 2008 use _IELinkGetCollection () to search the right link The functions i gave you should work. You just had false parameters i think. Link to comment Share on other sites More sharing options...
IndyUK Posted September 29, 2008 Author Share Posted September 29, 2008 Ok, I've modified the script as you can see but still not working.. #NoTrayIcon #include <IE.au3> $oIE = _IECreate("file:///C:/Users/indy/Documents/test.html", 0) $Handle = WinGetHandle("[CLASS:IEFrame]", "") $Title = WinGetTitle($oIE) If WinActive($Title) Then WinActivate($Title); $oForm = _IEFormGetObjByName($oIE, "Logon") $oLogin = _IEFormElementGetObjByName($oForm, "Name") $oPwd = _IEFormElementGetObjByName($oForm, "Password") _IEFormElementSetValue($oLogin, "*****") _IEFormElementSetValue($oPwd, "*****") $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks _IELinkClickByText ($oLinks, $oLink.href) Next Else MsgBox(16, "Page Error", "Error - Page not found") EndIf What am I doing wrong? Link to comment Share on other sites More sharing options...
IndyUK Posted September 30, 2008 Author Share Posted September 30, 2008 Ok, now I'm getting fustrated I login to my page ok and then when I issue the following code... $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks MsgBox(0,"",$oLink.href) Next ..to get back all the links and it don't work. What am I doing wrong? Link to comment Share on other sites More sharing options...
bluelamp Posted September 30, 2008 Share Posted September 30, 2008 What is in the variable @extended after you call the _IELinkGetCollection($oIE) function? It should be the number of links at the page. Link to comment Share on other sites More sharing options...
IndyUK Posted September 30, 2008 Author Share Posted September 30, 2008 Hi bluelampI checked the value and it is 9. However, I think it is working. I think it was because the AutoIt was too fast for the page and didn't give enough time for the page to render. I basically added..$oIE=_IEAttach("Welcome to Online Services","Text") _IELoadWait ($oIE)...and that seemed to give it enough time. Looks like I'm making some progress now. I'd like to thank you for your help and patience. It can be very fustrating for newbies when things just don't go our way. No doubt this being a steap learning curve I will be back with more queries...so hope you're around Thank you. Link to comment Share on other sites More sharing options...
bluelamp Posted September 30, 2008 Share Posted September 30, 2008 (edited) I think it was because the AutoIt was too fast for the page and didn't give enough time for the page to renderHm..ok... haven´t thought about that thing.I'd like to thank you for your help and patience. You ´re welcomeI will be back with more queries...so hope you're aroundI am almost every day in this forum Edited September 30, 2008 by bluelamp 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