Sign in to follow this  
Followers 0
Buchi

Using IELinkClickByText with $f_wait = 0 and still script pauses, bug?

6 posts in this topic

Hi,

I am using the IELinkClickByText function to click on a link that opens a modal IE dialog window. Being modal means that all the instances of IE for that app are not clickable, or get focus, but it seems that eventhough I use $f_wait = 0 parameter in my IELinkClickByText call, it still does not continue to execute my script.

Here is my code below:

$oFrame2 = _IEFrameGetCollection ($oIE, 2)
_IELinkClickByText ($oFrame2, "MW_TCA_HECI-1_02PRE1.zip ", 0, 0 )
MsgBox(0, "Testing", "Pause")

The message box only pops up after I manualy click cancel on the window that opens. So it seems that it is ignoring the $f_wait = 0 parameter.

I tried to use the #AutoIt3Wrapper_run_debug_mode=Y to see where the code stopped and it just shows the following:

(I kill the script after a while, hence the forcing abrupt termination....)

-----------------------------------------------------------------------------------------------

0088: 0-0: $oFrame2 = _IEFrameGetCollection ($oIE, 2)

0089: 0-3: _IELinkClickByText ($oFrame2, "MW_TCA_HECI-1_02PRE1.zip ", 0, 0 )

>Process failed to respond; forcing abrupt termination...

------------------------------------------------------------------------------------------------

I have searched the forum for problems with the Internet Explorer_TridentDlgFrame windows, and they all mention to send a keystroke to the window, but AutoIt script is paused, so no code gets executed after the IELinkClickByText function.

Any ideas on how to get the script to continue to execute?

Thanks

Share this post


Link to post
Share on other sites



You need to get AutoIt out of the processing loop for the popup. Do this be giving focus to the link and then using SEND.

$oLinks = _IELinkGetCollection($oFrame2)
For $oLink in $oLinks
    If String(_IEPropertyGet($oLink, "innertext")) = "MW_TCA_HECI-1_02PRE1.zip " Then
        _IEAction($oLink, "focus")
        Send("{Enter}")
        ExitLoop
    EndIf
Next

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

Share this post


Link to post
Share on other sites

Hi Dale,

Thanks for the help. I am getting the following error when I run the code you mention above.

Here is the error from SciTE:

0095: 0-0: If StringInStr($sLinkText, $sMyString) Then

0096: 0-0: _IEAction($oLink, "focus")

C:\Program Files\AutoIt3\Include\IE.au3 (2724) : ==> The requested action with this object has failed.:

$o_object.Focus ()

$o_object.Focus ()^ ERROR

->08:44:01 AutoIT3.exe ended.rc:1

Here is the code from the page where I am trying to click on the link:

CODE
</tr><tr class="ItemStyle">

<td style="width:40%;"> <a title='MW_TCA_HECI-1_02PRE1.zip' href="#" onclick="ViewScript('39')">MW_TCA_HECI-1_02PRE1.zip </a> </td>

<td style="width:20%;">Creek</td>

<td style="width:20%;">12/5/2007 2:51:13 PM </td>

<td style="width:20%;">TCA HECI 1.02 for LPI MW with config file for PRE1</td>

<td align="center" style="width:50px;"> <input type="image" name="ctl00$ContentPlaceHolder1$gvwScripts$ctl24$btnDelete" id="ctl00_ContentPlaceHolder1_gvwScripts_ctl24_btnDelete" src="../../Images/icon_delete.gif" onclick="btnDelete_Click();" style="border-width:0px;" /> </td>

</tr><tr class="AlternatingItemStyle">

Let me know if you need to see more of the code of the page.

So the focus does not seem to work on this particular piece of code.

Share this post


Link to post
Share on other sites

I can think of no reason you would get an error like that. The Focus action should work with any DOM element.

I suggest you put in an _IELoadWait($oFrame2) before that code to insure the page is not in transition. Unrealated to the error, but you may also want to look at example 2 for _IEAction for the syntax to use ControlSend instead of Send.

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

Share this post


Link to post
Share on other sites

I tried adding the _IELoadWait($oFrame2) code, but it did not help. I was already using enough sleep time to make sure the window loaded completely.

I looked at the code for ControlSend, but it still needs to set focus to the item before you send the command, so I would still run into the same problem where the focus causes an error.

Any other thoughts?

Share this post


Link to post
Share on other sites

Good News!

I fixed the problem. It turns out that there are 2 links in the collection that have the same text, but the first one was not able to get focus.

This is my modified code below:

$oFrame2 = _IEFrameGetCollection ($oIE, 2)
;~ _IELinkClickByText ($oFrame2, "MW_TCA_HECI-1_02PRE1.zip ", 1, 0 )
$sMyString = "MW_TCA_HECI-1_02PRE1.zip "
$iIndex=0
$oLinks = _IELinkGetCollection($oFrame2)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innertext")
    ;_IEAction($oLink, "focus")
    If StringInStr($sLinkText, $sMyString) Then
        If $iIndex = 1 Then
    _IEAction($oLink, "focus")
    Send("{Enter}")
    ExitLoop
        Else    
    $iIndex = $iIndex +1 
        EndIf
    EndIf
Next

Thanks for the help.

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