Jump to content

Unable to expand a link


Recommended Posts

Hi,

Need help here.

Please look at the attachment. I am unable click on [+] symbol to expand it. Any idea?

<span id="show_payment_advanced" style="display: block;">
    <a href="#link" onclick="expandDiv('payment_advanced','show_payment_advanced','hide_payment_advanced');">
       <img src="/ycc/images/expand.gif" alt="" width="11" height="11">
    </a>

    <a href="#link" onclick="expandDiv('payment_advanced','show_payment_advanced','hide_payment_advanced');">Show Additional Criteria</a>
</span>

post-80752-0-54286600-1394059752_thumb.j

Link to comment
Share on other sites

Did you try _IEImgClick on the gif ?

 

Yes.

_IEImgClick($oIE, "/ycc/images/expand.gif", "src")
_IEImgClick($oIE, "show_payment_advanced", "id")
_IEImgClick($oIE, "Show Additional Criteria", "alt")

Output:

--> IE.au3 T3.0-1 Warning from function _IEImgClick, $_IEStatus_NoMatch
--> IE.au3 T3.0-1 Warning from function _IEImgClick, $_IEStatus_NoMatch
Link to comment
Share on other sites

I tried this one below. Is it correct? 

$sMyString = "Show Additional Criteria"
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink In $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innertext")
        MsgBox(0, "", $sLinkText)
        ConsoleWrite("-->-- $sLinkText : " & $sLinkText & @CRLF)
        If StringInStr($sLinkText, $sMyString) Then
            _IEAction($oLink, "click")
            ExitLoop
        EndIf
    Next

Output is

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
-->-- $sLinkText : skip to header content
-->-- $sLinkText : skip to main content
-->-- $sLinkText : skip to sidebar content
-->-- $sLinkText : Help
-->-- $sLinkText :   Profile Settings
-->-- $sLinkText :   Log Out
-->-- $sLinkText : Administration
-->-- $sLinkText : Customer Management
-->-- $sLinkText : Case Management
-->-- $sLinkText : Audit Log
-->-- $sLinkText : Search
-->-- $sLinkText : OFAC
-->-- $sLinkText : Service Requests
-->-- $sLinkText : Routing Number Lookup 
-->-- $sLinkText : Routing Number Lookup 
-->-- $sLinkText : 0
-->-- $sLinkText : Show Advanced Options
-->-- $sLinkText : 0
-->-- $sLinkText : Hide Advanced Options
-->-- $sLinkText : 0
-->-- $sLinkText : Show Additional Criteria

Though at the bottom of output it shows -->-- $sLinkText : Show Additional Criteria, the click function is not working. Any help?

Link to comment
Share on other sites

 

Try this

$oLink.fireEvent("onclick")

 

Like this?

$sMyString = "Show Additional Criteria"
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink In $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innertext")
        MsgBox(0, "", $sLinkText)
        ConsoleWrite("-->-- $sLinkText : " & $sLinkText & @CRLF)
        If StringInStr($sLinkText, $sMyString) Then
            $oLink.fireEvent("onclick")
            ExitLoop
        EndIf
    Next
Link to comment
Share on other sites

 

Like this?

$sMyString = "Show Additional Criteria"
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink In $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innertext")
        MsgBox(0, "", $sLinkText)
        ConsoleWrite("-->-- $sLinkText : " & $sLinkText & @CRLF)
        If StringInStr($sLinkText, $sMyString) Then
            $oLink.fireEvent("onclick")
            ExitLoop
        EndIf
    Next

 

Nope. still the same. Not able to expand the [+] icon.  :sweating:

Link to comment
Share on other sites

not sure, but you can try with :

$iIndex = 0
$sMyString = "Show Additional Criteria"
$oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innertext")
    ConsoleWrite("-->-- $sLinkText : " & $sLinkText & @CRLF)
    If StringInStr($sLinkText, $sMyString) Then
        _IELinkClickByIndex($oIE, $iIndex)
        ExitLoop
    EndIf

    $iIndex += 1
Next
Link to comment
Share on other sites

 

not sure, but you can try with :

$iIndex = 0
$sMyString = "Show Additional Criteria"
$oLinks = _IELinkGetCollection($oIE)
For $oLink In $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innertext")
    ConsoleWrite("-->-- $sLinkText : " & $sLinkText & @CRLF)
    If StringInStr($sLinkText, $sMyString) Then
        _IELinkClickByIndex($oIE, $iIndex)
        ExitLoop
    EndIf

    $iIndex += 1
Next

 

No jguinch. This didnt work either.

Link to comment
Share on other sites

Hi Sammy,

Is there any chance you could post some more of the html, ideally including the "payment_advanced" DIV, so that we may have a play with this ourselves?

Thanks,

Val.

 

Hi Val,

Nothing much in HTML. I am just unable to click on [+] icon having "Show Additional Criteria" as string. Don't know why? Tried all methods. Now depending on Forum Geniuses. Thanks.

Link to comment
Share on other sites

The forum geniuses probably need that code you're not showing to figure out what to do with what you're trying to accomplish.

 

Just post the source of the page, or whatever it is you're automating so more eyes can see it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

#include <IE.au3>
#include <Date.au3>
#include <String.au3>
#include <Array.au3>
#include <Debug.au3>
#include <Excel.au3>
#include <Constants.au3>

#NoTrayIcon

Dim $aRecords

ProcessClose("iexplore.exe")

Local $sCellValue
Local $sFilePath1 = @ScriptDir & "\Sammy - Unsuspend.xlsx" ;This file should already exist
Local $oExcel = _ExcelBookOpen($sFilePath1) ; Opens an existing excel File

Local $file = FileOpen("Creds.txt", 0)
Local $AUsername = FileReadLine($file, 2)
Local $APassword = FileReadLine($file, 3)


; Open IE and sign into Sammy YCC
$oIE = _IECreate("URL")
_IELinkClickByText($oIE, "Continue to this website (not recommended).")
_IELoadWait($oIE)

$oForm = _IEFormGetObjByName($oIE, "loginForm")
$Username = _IEFormElementGetObjByName($oForm, "loginName")
$Password = _IEFormElementGetObjByName($oForm, "password")
$Login = _IEFormElementGetObjByName($oForm, "Submit")
_IEFormElementSetValue($Username, $AUsername)
_IEFormElementSetValue($Password, $APassword)
_IEAction($Login, "click")
_IELoadWait($oIE)

For $i = 1 To 1000

    $sDate = _ExcelReadCell($oExcel, 1, 1) ; Reads the value of 1st cell (A1)
    $sCellValue = _ExcelReadCell($oExcel, $i, 2) ; Reads the value of 2nd cell (A2)


    If $sCellValue = "" Then
        _IEQuit($oIE)
        Exit
    EndIf

    _ExcelWriteCell($oExcel, "Processing...", $i, 3)

    _IELinkClickByIndex($oIE, 11)

    ; Below code will find subtabs
    $oButton = $oIE.document.GetElementById("tab2Name")
    $oButton.fireEvent("onclick")

    $oForm1 = _IEFormGetObjByName($oIE, "transactionForm")
    $ofi2 = _IEFormElementGetObjByName($oForm1, "transactionType")
    _IEFormElementOptionSelect($ofi2, "Payment", 1, "byText")

    $ofi3 = _IEFormElementGetObjByName($oForm1, "payment.customer.userName")
    _IEFormElementSetValue($ofi3, $sCellValue)

    _IELinkClickByText($oIE, "Show Additional Criteria")
    _IEImgClick($oIE, "/ycc/images/expand.gif", "src")
    _IEImgClick($oIE, "show_payment_advanced", "id")
    _IEImgClick($oIE, "Show Additional Criteria", "alt")

;~  _IEFormImageClick($oIE, "/ycc/images/expand.gif", "src")
;~  _IEFormImageClick($oIE, "show_payment_advanced", "id")
;~  _IEFormImageClick($oIE, "Show Additional Criteria", "alt")

    $iIndex = 0
    $sMyString = "Show Additional Criteria"
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink In $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innertext")
        ConsoleWrite("-->-- $sLinkText : " & $sLinkText & @CRLF)
        If StringInStr($sLinkText, $sMyString) Then
            _IELinkClickByIndex($oIE, $iIndex)
            ExitLoop
        EndIf

        $iIndex += 1
    Next

Exit

    $ofi4 = _IEFormElementGetObjByName($oForm1, "payment.optionsBox")
    _IEFormElementOptionSelect($ofi2, "Payment Status", 1, "byText")

    $oForm1 = _IEFormGetObjByName($oIE, "findCustomer")
    $oQuery1 = _IEFormElementGetObjByName($oForm1, "customerForm.customer.userName")

    _IEFormElementSetValue($oQuery1, $sCellValue)

    _IEFormSubmit($oForm1)

    _IELinkClickByIndex($oIE, 21)

    $oSelect = _IEGetObjByName($oIE, "actions_top")
    _IEFormElementOptionSelect($oSelect, "Activate Account", 1, "byText")
    _IENavigate($oIE, "javascript:takeCustomerAction();", 0)

    Sleep(3000)

    Send("{TAB}")
    Send("{TAB}")
    Send("{DOWN}")
    Send("{TAB}")

    Send("Test performed on " & $sDate)

    Send("{TAB}")
    Send("{ENTER}")

    Sleep(5000)

    _IELinkClickByText($oIE, "Case Management")

    _ExcelWriteCell($oExcel, "Unsuspended", $i, 3)
    _ExcelBookSave($oExcel)

Next 

Here is full code:

Link to comment
Share on other sites

This is where you need to post the code of the page you're trying to automate and not your script so that we can see what needs to be done.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

This is where you need to post the code of the page you're trying to automate and not your script so that we can see what needs to be done.

 

Here is the source code:

<div id="section.p2pPayment"  style="display:none">
    <div class="two_columns">
        <div class="column1">
            <dl class="paymentMediumDl">
                <dt>
                    <label for="p2pPayment.confirmationNumber">Confirmation Number:</label>
                </dt>
                <dd>
                    <input size="30" name="p2pPayment.confirmationNumber" id="p2pPayment.confirmationNumber" type="text" value="" />
                    <div class="error" id="error.p2pPayment.confirmationNumber"></div>
                </dd>
            </dl>
                        
                <dl class="paymentMediumDl">
                    <dt><label for="p2pPayment.customer.userName">Customer Username:</label></dt>
                    <dd>
                        <input name="p2pPayment.customer.userName" size="30" id="p2pPayment.customer.userName" type="text" value="" /><br />
                        <div class="error" id="error.p2pPayment.customer.userName"></div>
                    </dd>
                </dl>
            
            
            <dl class="paymentMediumDl">
                <dt><label for="p2pPayment.customer.firstName">First Name:</label></dt>
                <dd>
                    <input name="p2pPayment.customer.firstName" size="30" id="p2pPayment.customer.firstName" type="text" value="" />
                    <div class="error" id="error.p2pPayment.customer.firstName"></div>
                </dd>
            </dl>
            <dl class="paymentMediumDl">
                <dt><label for="p2pPayment.customer.lastName">Last Name:</label></dt>
                <dd>
                    <input name="p2pPayment.customer.lastName" size="30" id="p2pPayment.customer.lastName" type="text" value="" />
                    <div class="error" id="error.p2pPayment.customer.lastName"></div>
                </dd>
            </dl>
        </div>
        <div class="column2">
            <dl class="paymentDl">
                <dt>
                    <label for="p2pPayment.emailAddress">Recipient Email Id:</label>
                </dt>
                <dd>
                    <input size="30" type="text" id="p2pPayment.emailAddress" name="p2pPayment.emailAddress"  value="" />
                    <div class="error" id="error.p2pPayment.emailAddress"/>
                </dd>
            </dl>
            <dl class="paymentDl">
                <dt>
                    <label for="p2pPayment.mobileNumber">Recipient Mobile Number:</label>
                </dt>
                <dd>
                    <input size="30" type="text" id="p2pPayment.mobileNumber" name="p2pPayment.mobileNumber"  value="" />
                    <div class="error" id="error.p2pPayment.mobileNumber"/>
                </dd>
            </dl>
            <dl class="paymentDl">
                <dt>
                    <label for="p2pPayment.paymentAccountNumber">Payment Account Number:</label>
                </dt>
                <dd>
                    <input name="p2pPayment.paymentAccountNumber" size="30" id="p2pPayment.paymentAccountNumber" type="text" value="" />
                    <div class="error" id="error.p2pPayment.paymentAccountNumber"></div>
                </dd>
            </dl>
            <dl class="paymentDl">
                <dt>
                    <label for="p2pPayment.routingNumber">Routing Number:</label>
                </dt>
                <dd>
                    <input name="p2pPayment.routingNumber" size="30" id="p2pPayment.routingNumber" type="text" value="" /><br>
                    <span class="hspace1"><a href="http://www.fededirectory.frb.org/search.cfm" target="_blank">
                        Routing Number Lookup</a></span>
                    <div class="error" id="error.p2pPayment.routingNumber"></div>
                </dd>
            </dl>
        </div>
    </div>
    <div class="two_columns">
        <div class="column1">
            <dl>
                <dt>
                    <span id="show_p2pPayment_advanced">
                        <a href="#link" onclick="expandDiv('p2pPayment_advanced','show_p2pPayment_advanced','hide_p2pPayment_advanced');"><img src="/ycc/images/expand.gif" alt='' width="11" height="11" /></a> <a href="#link" onclick="expandDiv('p2pPayment_advanced','show_p2pPayment_advanced','hide_p2pPayment_advanced');">Show Additional Criteria</a>
                    </span>
                    <span id="hide_p2pPayment_advanced" style="display:none;">
                        <a href="#link" onclick="collapseDiv('p2pPayment_advanced','show_p2pPayment_advanced','hide_p2pPayment_advanced');"><img src="/ycc/images/collapse.gif" alt='' width="11" height="11" /></a> <a href="#link" onclick="collapseDiv('p2pPayment_advanced','show_p2pPayment_advanced','hide_p2pPayment_advanced');">Hide Additional Criteria</a>
                    </span>
                </dt>
                <dd>
                </dd>
                </td>
            </dl>
        </div>
    </div>
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...