Jump to content

Javascript button click problem


Recommended Posts

I cannot get this to click. I've tried _IEAction, _IEFormImageClick, _IEImgClick, & _IEImgClick. I'm sure I'm referencing it wrong. I'd post my code, but I'm not even sure what function to be using. I'd really appreciate a push in the right direction. Thanks!!

<TD style="display:none" id="tdBtnAccount" width="16%" bgcolor="white">

<DIV id="div1" width="100%" class="lmNormal"><A class="lmNormal" id="button1" href="java script:Navigate('button1','/access/account.aspx','div1')">Account</A></DIV>

Link to comment
Share on other sites

You have to drill down to the button and then getting it. _IEAction will be the command you will want to use but you will need to get a reference to it before you can do that.

Start by trying to get a reference to the Div with _IEGetObjById. Once you have the div, then you can go for the button contained within it.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

following on from above, I would expect _IELinkClickByText($oIE, "Account") to work

Also

$oHref = _IEGetObjById($oIE, "button1")

_IEAction($oHref, "click")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thanks so much for the suggestions, but neither work. Here's more of the page. It's the Account button at the top that I'm trying to click. I just want to avoid having to tab to the button.

Posted Image

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML>
<HEAD>
    <TITLE>Access</TITLE>
<META HTTP-EQUIV='PRAGMA' CONTENT='NO-CACHE'><META NAME='MS.LOCALE' CONTENT='en-us' /></HEAD>
<script language='Javascript' src='/access/script/formValidation.js'></SCRIPT>
<script language='Javascript' src='/access/script/listFunctions.js'></SCRIPT>
<script language='Javascript' src='/access/script/global.js'></SCRIPT>
<script language='Javascript' src='/access/script/xmldom.js'></SCRIPT>
<script language='Javascript' src='/access/script/modxml.js'></SCRIPT>
<LINK REL=stylesheet href='/assets/style/global.css' type=text/css>
<LINK REL=stylesheet href='/assets/style/RH.css' type=text/css><BODY onload="if(parent.frames.length==0) parent.location='welcome.aspx';">
<IFRAME id="budgetIframe" name="budgetIframe" style="DISPLAY: none; Z-INDEX: 1; LEFT: 350px; WIDTH: 405px; POSITION: absolute; TOP: 150px;HEIGHT:85px" marginheight="0" marginwidth="0" noresize frameborder="yes" scrolling="no" src=/access/blank.aspx?sessionKey=Vjtx0qCMUCCFU5Y12hmYUQiJU39CSXXVjAFWbK2kt%2bNKFG64lpaHiNEoASAnEPnVndy44hAEqdAdv786cwZy9i1%2bMFr8a5cuyvt7jUw9e%2bDKbMtnX%2fL89rRWAQuuN7Fh8%2bbYkh2ilG%2bmn2McWW9%2bkSJ3C4TnHBvDq2zhnDx4ah%2flhWTPsxWPHREvaS3XTn%2bu></IFRAME>

<FORM name="formMenu" action="/access/frmBrowse.aspx?sessionKey=Vjtx0qCMUCCFU5Y12hmYUQiJU39CSXXVjAFWbK2kt%2bNKFG64lpaHiNEoASAnEPnVndy44hAEqdAdv786cwZy9i1%2bMFr8a5cuyvt7jUw9e%2bDKbMtnX%2fL89rRWAQuuN7Fh8%2bbYkh2ilG%2bmn2McWW9%2bkSJ3C4TnHBvDq2zhnDx4ah%2flhWTPsxWPHREvaS3XTn%2bu" method="get" target="frmMain" onsubmit="goSearch(); return false;">
    <TABLE cellspacing="0" cellpadding="0" border="0" width="100%" height="100%">
        <TR>
            <TD width="100%" colspan="3">
<TABLE cellpadding="0" cellspacing="1" width="100%" class="siteBG">
    <TR align="middle" class="siteBG">
        <TD style="display:none" id="tdBtnHome" width="16%" bgcolor="white"><DIV id='div0' width='100%' class='lmClick'><A class=lmClick id=button0 href="java script:Navigate('button0','/access/home.aspx','div0');">Home</A></DIV></TD></TD>
        <TD style="display:none" id="tdBtnAccount" width="16%" bgcolor="white">
            <DIV id="div1" width="100%" class="lmNormal"><A class="lmNormal" id="button1" href="java script:Navigate('button1','/access/account.aspx','div1')">Account</A></DIV>
        </TD>
        <TD style="display:none" id="tdBtnOrderMenu" width="16%" bgcolor="white">
            <DIV id="div2" width="100%" class="lmNormal"><A class="lmNormal" id="button2" href="java script:Navigate('button2','/access/ordermenu.aspx','div2')">Order</A></DIV>
        </TD>
        <TD style="display:none" id="tdBtnCart" width="16%" bgcolor="white">
            <DIV id="div3" width="100%" class="lmNormal"><A class="lmNormal" id="button3" href="java script:Navigate('button3','/access/cart.aspx', 'div3')">Cart</A></DIV>
        </TD>
        <TD style="display:none" id="tdBtnCheckOut" width="16%" bgcolor="white">
            <DIV id="div4" class="lmNormal"><A class="lmNormal" id="button4" href="java script:Navigate('button4','/access/checkout.aspx?cStage=Exception', 'div4')">Submit</A></DIV>
        </TD>
    </TR>
</TABLE>
Link to comment
Share on other sites

There is a good chance that what you want is in a frame. Hopefully you are running this from SciTe - you should be getting NOMATCH messages which will help you debug. Also, suggest you download DebugBar.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...