Sign in to follow this  
Followers 0
IndyUK

Working with tables

11 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try this:

$oTable = _IEGetObjById ($oForm, "anchor1") 
_IEAction($oTable, "click")
Edited by bluelamp

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

share you complete script please

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

use _IELinkGetCollection () to search the right link

The functions i gave you should work.

You just had false parameters i think.

Share this post


Link to post
Share on other sites

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? :)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

What is in the variable @extended after you call the _IELinkGetCollection($oIE) function?

It should be the number of links at the page.

Share this post


Link to post
Share on other sites

Hi bluelamp

I 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.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I think it was because the AutoIt was too fast for the page and didn't give enough time for the page to render

Hm..ok... haven´t thought about that thing.

I'd like to thank you for your help and patience.

You ´re welcome

I will be back with more queries...so hope you're around

I am almost every day in this forum :) Edited by bluelamp

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