avidovi

_IELinkClickByText, $_IESTATUS_NoMatch

20 posts in this topic

Hello all,

I need help regarding "_IELinkClickByText"

The HTML Code is:

<span class="ng-binding" ng-bind="::transaction.arrival_time | userDate : ta.data.settings.profile_settings">20160518 01:20:30</span>

In my code i need to click the text (in bold), i keep getting $_IESTATUS_NoMatch.

What am i missing???

Many thanks.

Share this post


Link to post
Share on other sites



Please post url to the website or post here a little wider HTML snippet.

 


ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-12-23
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Sorry, i cannot post the url (it requires User Nmae and password)

Attach a text file and pic with some more detailes.

As u see i need to click the first link (20160518 01:20:30) i can get the link but when i am using _IEClickbytext it keeps telling me IE_Status_NOt_Match:'(

I relly aprriciate your help!

 

Element.txt

Capture.JPG

Edited by avidovi
update

Share this post


Link to post
Share on other sites
1 hour ago, avidovi said:

As u see i need to click the first link (20160518 01:20:30) i can get the link but when i am using _IEClickbytext it keeps telling me IE_Status_NOt_Match:'(

_IEClickbytext only works on true links (<A> elements), so you can't use to click a SPAN. Did you try searching the forum threads for a solution?

Share this post


Link to post
Share on other sites

Thanks @Danp2 i did not know that.

I have searched the forum for a solution but it didn't work.

Can u suggest me one?

Thank a lot..

Share this post


Link to post
Share on other sites
Local $oClassReturn = $oIE.document.getElementsByClassName("ng-scope")
If Not IsObj($oClassReturn) Then Exit ConsoleWrite("Error in $oClassReturn" & @CRLF)

Local $oTagReturn = $oClassReturn.Item(0).getElementsByTagName("span")
If Not IsObj($oTagReturn) Then Exit ConsoleWrite("Error in $oTagReturn" & @CRLF)

$oTagReturn.Item(0).click()

Hi avidovi,

Without seeing your AutoIT code I can't tell if you're using $oIE as your IE Object handle but if so then try the above code, you may need to increase $oTagReturn.Item(0).click() up by 1 until it corresponds with the correct selection.

Hope this works for you.

Share this post


Link to post
Share on other sites

As I stated before show little wider HTML snippet, for example inspect the entire row which was showed in screenshot from post #3.
Of course you can edit, and delete some sensitive data.

 

 


ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-12-23
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

@mLipok and @Dent thanks for your help.

I tried Dents option - and i am getting no values at all.

@mLipok as u requested atached the whole row

again thank!!

<tr class="firstline twolines" ng-class="{openmessage: transaction.show_info, twolines: search.layout.rows == 2, oneline: search.layout.rows == 1}"><td><a ui-sref=".details.details({'transactionId':transaction.id})" ng-click="ta.setSelectedTransaction(transaction.id); $event.stopPropagation();" title="UTC+03:00" href="/app/transactions/EDIVAN1-PROD-GEISCO3P252U670001-20160525192046/details"><span ng-bind="::transaction.arrival_time | userDate : ta.data.settings.profile_settings" class="ng-binding">20160526 05:20:46</span></a> <!-- ngIf: search.layout.rows == 1 --> <!-- ngIf: search.layout.rows == 1 && transaction.fa_status --></td><!-- ngRepeat: title in search.layout.first_row --><td ng-repeat="title in search.layout.first_row" ng-show="title.FieldEntry != null" colspan="1" ng-class="{'last-field':$last}" set-field-value="" transaction="transaction" field="title" class="ng-scope ng-isolate-scope ng-hide"><!-- ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngRepeat: label in transaction.values['labels_orig'] track by $index --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><div ng-if="search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" class="ng-scope"><!-- ngIf: !title.can_add_to_facet && !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20) --><span ng-if="!title.can_add_to_facet &amp;&amp; !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 &amp;&amp; transaction.values[title.FieldEntry.IndexFieldName].length == 20)" ng-bind="::transaction.values[title.FieldEntry.IndexFieldName] " class="ng-binding ng-scope"></span><!-- end ngIf: !title.can_add_to_facet && !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20) --> <!-- ngIf: !title.can_add_to_facet && title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20 --></div><!-- end ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) !== -1 && title.FieldEntry.IndexFieldName != 'labels' --></td><!-- end ngRepeat: title in search.layout.first_row --><td ng-repeat="title in search.layout.first_row" ng-show="title.FieldEntry != null" colspan="1" ng-class="{'last-field':$last}" set-field-value="" transaction="transaction" field="title" class="ng-scope ng-isolate-scope" title="KOHLS"><!-- ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><a ng-if="title.can_add_to_facet &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" ng-click="ta.addFilterFromList(transaction, title);$event.stopPropagation();" class="ng-scope"><span ng-bind="::transaction.values[title.FieldEntry.IndexFieldName]" class="ng-binding">KOHLS</span></a><!-- end ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngRepeat: label in transaction.values['labels_orig'] track by $index --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><div ng-if="search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" class="ng-scope"><!-- ngIf: !title.can_add_to_facet && !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20) --> <!-- ngIf: !title.can_add_to_facet && title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20 --></div><!-- end ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) !== -1 && title.FieldEntry.IndexFieldName != 'labels' --></td><!-- end ngRepeat: title in search.layout.first_row --><td ng-repeat="title in search.layout.first_row" ng-show="title.FieldEntry != null" colspan="1" ng-class="{'last-field':$last}" set-field-value="" transaction="transaction" field="title" class="ng-scope ng-isolate-scope" title="TAA APPAREL"><!-- ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><a ng-if="title.can_add_to_facet &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" ng-click="ta.addFilterFromList(transaction, title);$event.stopPropagation();" class="ng-scope"><span ng-bind="::transaction.values[title.FieldEntry.IndexFieldName]" class="ng-binding">TAA APPAREL</span></a><!-- end ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngRepeat: label in transaction.values['labels_orig'] track by $index --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><div ng-if="search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" class="ng-scope"><!-- ngIf: !title.can_add_to_facet && !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20) --> <!-- ngIf: !title.can_add_to_facet && title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20 --></div><!-- end ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) !== -1 && title.FieldEntry.IndexFieldName != 'labels' --></td><!-- end ngRepeat: title in search.layout.first_row --><td ng-repeat="title in search.layout.first_row" ng-show="title.FieldEntry != null" colspan="1" ng-class="{'last-field':$last}" set-field-value="" transaction="transaction" field="title" class="ng-scope ng-isolate-scope" title="GEISCO3P252U670001-20160525192046"><!-- ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngRepeat: label in transaction.values['labels_orig'] track by $index --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><div ng-if="search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" class="ng-scope"><!-- ngIf: !title.can_add_to_facet && !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20) --><span ng-if="!title.can_add_to_facet &amp;&amp; !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 &amp;&amp; transaction.values[title.FieldEntry.IndexFieldName].length == 20)" ng-bind="::transaction.values[title.FieldEntry.IndexFieldName] " class="ng-binding ng-scope">GEISCO3P252U670001-20160525192046</span><!-- end ngIf: !title.can_add_to_facet && !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20) --> <!-- ngIf: !title.can_add_to_facet && title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20 --></div><!-- end ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) !== -1 && title.FieldEntry.IndexFieldName != 'labels' --></td><!-- end ngRepeat: title in search.layout.first_row --><td ng-repeat="title in search.layout.first_row" ng-show="title.FieldEntry != null" colspan="1" ng-class="{'last-field':$last}" set-field-value="" transaction="transaction" field="title" class="ng-scope ng-isolate-scope last-field" title="EDI"><!-- ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><a ng-if="title.can_add_to_facet &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" ng-click="ta.addFilterFromList(transaction, title);$event.stopPropagation();" class="ng-scope"><span ng-bind="::transaction.values[title.FieldEntry.IndexFieldName]" class="ng-binding">EDI</span></a><!-- end ngIf: title.can_add_to_facet && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngRepeat: label in transaction.values['labels_orig'] track by $index --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><div ng-if="search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 &amp;&amp; title.FieldEntry.IndexFieldName != 'labels'" class="ng-scope"><!-- ngIf: !title.can_add_to_facet && !(title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20) --> <!-- ngIf: !title.can_add_to_facet && title.FieldEntry.IndexFieldName.indexOf('date') > -1 && transaction.values[title.FieldEntry.IndexFieldName].length == 20 --></div><!-- end ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) === -1 && title.FieldEntry.IndexFieldName != 'labels' --><!-- ngIf: search.linkFields.indexOf(title.FieldEntry.IndexFieldName) !== -1 && title.FieldEntry.IndexFieldName != 'labels' --></td><!-- end ngRepeat: title in search.layout.first_row --><td class="quickactions-field" rowspan="2"><!-- ngIf: !transaction.selected --><div ng-if="!transaction.selected" ng-click="ta.openQuickActions(transaction.id, $event)" class="toggle-item-actions ng-scope" data-toggle="dropdown" role="button"><div class="qact-btn"></div></div><!-- end ngIf: !transaction.selected --><!-- ngIf: transaction.selected --></td><td rowspan="2" class="toggle maintoggle pointer" ng-click="search.toggleMoreInfo(transaction);$event.stopPropagation();" ng-class="{active: transaction.show_info}"></td></tr>

 

Share this post


Link to post
Share on other sites

anyone please?

Share this post


Link to post
Share on other sites

Its very hard to help when we can not see the URL (i know that it requires username and password) and the code that you are using to try to click. You could be dealing with frames here, have you check that possibilitie?

From what i can see the span element its inside the "a" element so as the func "_IELinkClickByText" use "outerText" it should grab it. From the html that you have provided i have tested and its working. See if you are dealing with frames and test this:

#include <IE.au3>

Local $oIE = ;******* i dont know if you are using IECreate or IEAttach, just put it here
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

Local $oFrames = _IEFrameGetCollection($oIE)
If @error Then
    Exit ConsoleWrite("Error in $oFrames" & @CRLF)
Else
    Local $iNumFrames = @extended
EndIf

MsgBox(0, "", "Nº Frames: " & $iNumFrames)

Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    If Not IsObj($oFrame) Or @error Then Exit ConsoleWrite("Error in $oFrame | @error: " & @error & @CRLF)
    
    _IELinkClickByText($oFrame, "20160526 05:20:46", 0, 0) ;*********** make sure the text is equal in the website
    If @error Then
        MsgBox(0, "", "@error: " & @error)
    Else
        Exit MsgBox(0, "Link Found", "Check if the link was clicked")
    EndIf
Next

MsgBox(0, "", "Link Not Found")

Exit

Please pay attention to the commented lines.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

@MichaelHB Thanks for answering.

I tried youre code - its geting no iframs at all. (0)

Edited by avidovi

Share this post


Link to post
Share on other sites

Lets try another code:

#include <IE.au3>

Local $oIE = ;******* i dont know if you are using IECreate or IEAttach, just put it here
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
If Not IsObj($oLinks) Or @error Then Exit ConsoleWrite("Error in $oLinks | @error: " & @error & @CRLF)

ConsoleWrite("Nº of Links: " & $iNumLinks & @CRLF & @CRLF)

For $oLink In $oLinks
    ConsoleWrite("TEXT: " & $oLink.outerText & @CRLF)
    ConsoleWrite("HREF: " & $oLink.href & @CRLF & @CRLF)
Next

ConsoleWrite(@CRLF & "######################################################" & @CRLF & @CRLF& @CRLF)

Local $sHTML = _IEDocReadHTML($oIE)
If @error Then Exit ConsoleWrite("Error in $sHTML")

Local $aLinks = StringRegExp($sHTML, '(?is)<a (.*?)</a>', 3)
If @error Then Exit ConsoleWrite("Error in $aLinks | @error: " & @error & @CRLF)

ConsoleWrite("Nº of Links: " & UBound($aLinks) & @CRLF & @CRLF)

For $i = 0 To UBound($aLinks)-1
    $aResultText  = StringRegExp($aLinks[$i], '>([^<]+)', 3)
    If @error Then Exit ConsoleWrite("Error in $aResultText | $i: " & $i & " | @error: " & @error & @CRLF)
    ConsoleWrite("TEXT: ")
    For $j = 0 To UBound($aResultText)-1
        If Not StringRegExp($aResultText[0], "[A-Za-z0-9]") Then ContinueLoop
        If $j > 0 Then ConsoleWrite(" ")
        ConsoleWrite($aResultText[$j])
    Next
    ConsoleWrite(@CRLF & "HREF: ")

    $aResultHref  = StringRegExp($aLinks[$i], 'href="([^"]+)', 3)
    If @error Then
        ConsoleWrite("0")
        ConsoleWrite(@CRLF & @CRLF)
        ContinueLoop
    EndIf
    For $j = 0 To UBound($aResultHref)-1
        If $j > 0 Then ConsoleWrite(" ")
        ConsoleWrite($aResultHref[$j])
    Next
    ConsoleWrite(@CRLF & @CRLF)
Next

ConsoleWrite(@CRLF & "####### OK #######" & @CRLF)

Exit

I need all the console output.

Share this post


Link to post
Share on other sites

Sometimes help including localhost/127.0.0.1 into IE trusted zone...

Share this post


Link to post
Share on other sites
On 5/29/2016 at 6:00 AM, Iczer said:

Sometimes help including localhost/127.0.0.1 into IE trusted zone...

@Iczer Can u explain please?

 

Thanks

Share this post


Link to post
Share on other sites

Try both codes and let me know the output. Make sure that the current website has the link 20160518 01:20:30 (use Ctrl+f in the website, just to make sure).

#include <IE.au3>

Local $oIE = ;******* i dont know if you are using IECreate or IEAttach, just put it here
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
If Not IsObj($oLinks) Or @error Then Exit ConsoleWrite("Error in $oLinks | @error: " & @error & @CRLF)

ConsoleWrite("Nº of Links: " & $iNumLinks & @CRLF & @CRLF)

Local $sLinkOuterText, $sLinkHref
For $oLink In $oLinks
    $sLinkOuterText = $oLink.outerText
    $sLinkHref = $oLink.href
    ConsoleWrite("TEXT: " & $sLinkOuterText & @CRLF)
    ConsoleWrite("HREF: " & $sLinkHref & @CRLF)
    If $sLinkOuterText = "20160518 01:20:30" Then
        _IEAction($oLink, "click")
        ConsoleWrite("Link found and clicked." & @CRLF)
        Exit
    EndIf
    ConsoleWrite(@CRLF)
Next

Exit
#include <IE.au3>

Local $oIE = ;******* i dont know if you are using IECreate or IEAttach, just put it here
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

_IELinkClickByText($oIE, "20160518 01:20:30")
If @error Then ConsoleWrite("Error n:" & @error & @CRLF)

Exit

 

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

22 hours ago, MichaelHB said:

Try both codes and let me know the output. Make sure that the current website has the link 20160518 01:20:30 (use Ctrl+f in the website, just to make sure).

#include <IE.au3>

Local $oIE = ;******* i dont know if you are using IECreate or IEAttach, just put it here
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
If Not IsObj($oLinks) Or @error Then Exit ConsoleWrite("Error in $oLinks | @error: " & @error & @CRLF)

ConsoleWrite("Nº of Links: " & $iNumLinks & @CRLF & @CRLF)

Local $sLinkOuterText, $sLinkHref
For $oLink In $oLinks
    $sLinkOuterText = $oLink.outerText
    $sLinkHref = $oLink.href
    ConsoleWrite("TEXT: " & $sLinkOuterText & @CRLF)
    ConsoleWrite("HREF: " & $sLinkHref & @CRLF)
    If $sLinkOuterText = "20160518 01:20:30" Then
        _IEAction($oLink, "click")
        ConsoleWrite("Link found and clicked." & @CRLF)
        Exit
    EndIf
    ConsoleWrite(@CRLF)
Next

Exit
#include <IE.au3>

Local $oIE = ;******* i dont know if you are using IECreate or IEAttach, just put it here
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

_IELinkClickByText($oIE, "20160518 01:20:30")
If @error Then ConsoleWrite("Error n:" & @error & @CRLF)

Exit

 

First thank u!!!

i did not really understand how the link was clicked??  i  did the same thing with _IELinkClickByText but in my script it did not worked.

Can u explain to me please.

attached the first code output.

First code.txt

Edited by avidovi

Share this post


Link to post
Share on other sites
52 minutes ago, avidovi said:

first thank u

You are welcome. :)

52 minutes ago, avidovi said:

second can u explain to me please.

You missed something but i cant know what without seeing all the code that you were using. Both codes worked for you?

Share this post


Link to post
Share on other sites

yes

Share this post


Link to post
Share on other sites

The first code basically does the same as the second, was just to make sure that you have not changed the IE UDF code. As i stated before i cant know what was the issue without seeing the code that you were using.

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

  • Similar Content

    • boooooom
      By boooooom
      I'm trying to get the HTML code after executing javascript in IE. Here is my code.
      $url = "http://example.com" $oIE = _IECreate($url) Sleep(3000) ;waiting for executing javascript. But useless. $oFrame = _IEFrameGetCollection($oIE, 0) $sCode &= _IEPropertyGet($oFrame, "innerhtml") & @CRLF Then, I get this error.
      "C:\Program Files (x86)\AutoIt3\Include\IE.au3" (2308) : ==> The requested action with this object has failed.: $oTemp = $oObject.document.body $oTemp = $oObject^ ERROR After executing javascript, when I view source in IE, there are HTML code like below.
      <html> <head> ... </head> <body> ... </body> </html> What should I do?
    • MattG1991
      By MattG1991
      Hello all, 
      I've written a script that pulls info from some web pages, saves the results to variables, and prints it out to a Word document. I've tried to make this script work with a minimum of user interaction. I've noticed an issue happens when I run the script and I have another window set as active, like SciTE for example. It inserts an "ETX" character. I've done this with Notepad too. It displays an upside down L character. Any particular reason why? Unfortunately, I can't post any code. Basically, it gets a collection of tags, applies a test to find the values I want, then pulls the innerhtml from said tag. Then it assigns the results to a global variable.  Any help would be appreciated. 
    • CT83
      By CT83
      I send Pushbullet Updates (pushbullet.com) of my script using its native API and i have the following code to do the same, but in some cases my internet connection sometimes stops responding and the notification can't be send  using HTTP.send($sPD) methods,in such cases due to the lack of internet connection a runtime error (The requested action with this object has failed) is generated! This creates problems, as the stability of my script is affected. Is there a way to solve this problem?
      Func Send_Pushbullet($spTitle,$sBody,$GFPsh_Tk) Local $sPD = '{"type": "note", "title": "'&$spTitle&'","body": "'&$sBody&'"}' $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://api.pushbullet.com/v2/pushes", False) $oHTTP.setRequestHeader("Authorization", "Bearer " & $GFPsh_Tk) $oHTTP.SetRequestHeader("Content-Type", "application/json") $oHTTP.Send($sPD) $Result = $oHTTP.ResponseText ToolTip2("PushBullet :"&$Result) ToolTip2("PushBullet Sent - "&$spTitle&" : "&$sBody&" "&$GFPsh_Tk) EndFunc  
    • jonson1986
      By jonson1986
      Hello I'm trying to translate few text using below code, I found it working previously couple of months ago but Now these days it's not working at all and I'm getting below errors when I run the script and Array display at the end of text also not able to show any translated text instead of value 0 & 1;
      --> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (gt-res-data)
      --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType
      Here is code,
      #include <IE.au3> #include <Array.au3> Local $tag="* # * # *" Local $oIE=_IECreate("https://translate.google.com/#auto/es") Local $oForm=_IEFormGetCollection($oIE,0) Local $oQuery=_IEGetObjByName($oForm,"text") _IEFormElementSetValue($oQuery, $tag & @CR & "Hello World" & @CR & "This is a test" & @CR & $tag) _IEFormSubmit($oForm) _IELoadWait($oIE) Local $oText=_IEGetObjById($oIE,"gt-res-data") $lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1) _IEQuit($oIE) _ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines[0]) _ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1)) $lines[0]=UBound($lines)-1 _ArrayDisplay($lines)  
    • PunkoHead
      By PunkoHead
      Hi all,
      I am having an issue with a website that I want to automate.
      I have this menu and I want to click on the Custom button.

       
       
      The buttons with "inspect element" are: 
       

       
      The code that I tried is
      $sSearch = "Custom" $oFrame = _IEFrameGetObjByName($oIE, "options") $oDivs = _IETagNameGetCollection($oFrame, "ul") For $oDiv In $oDivs If String(_IEPropertyGet($oDiv, "InnerText")) = $sSearch Then _IEAction($oDiv, "click") ExitLoop EndIf Next I also tried with:
      $sMyString = "Custom" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next  
      However, these are not working. Any ideas?