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.

 


February 26, 2017: New SciTE4AutoIt3 available with the updated SciTE v3.7.3 release
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: 2017-02-26
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.au3 UDF * TeamViewer.au3 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.

 

 


February 26, 2017: New SciTE4AutoIt3 available with the updated SciTE v3.7.3 release
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: 2017-02-26
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.au3 UDF * TeamViewer.au3 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

    • mjolnirmarkiv
      By mjolnirmarkiv
      Hi!
      Does anyone have any idea why Test() returns 0, while Test2() returns 1?
      #include <IE.au3> MsgBox(0, "", Test() & " " & Test2()) Func Test() Local $oHTML = ObjCreate("HTMLFILE") $oHTML.body.innerHTML = FileRead("Test.html") Return IsObj($oHTML.getElementsByClassName("example")) EndFunc Func Test2() Local $oIE = _IEAttach("", "instance", 1) Return IsObj($oIE.document.getElementsByClassName("example")) EndFunc Sample Test.html I open in IE before testing:
      <!DOCTYPE html> <html> <body> <p class="example"></p> <div class="example"></div> </body> </html> I'm receiving html text in a response to http request, I need to parse it fast and easy, getElementsByClassName would have been ideal. I'm using 3.3.12.0 version.
    • ADIN
      By ADIN
      When at some page i access by  IE.au3 appears javascript alert all my code stops and i cant do nothing. Is there any way to stop executing javascript at this page or any way to force autoit to click "OK" when this alert appears?
       
      _IENavigate($oIE, "www.example.com") _IELoadWait($oIE) ; site is loaded and alert appears Send("{ENTER}") ;i want to close alert, this command is not executed, whole script is freeze ; cant do nothing more here....  
    • ADIN
      By ADIN
      I want use _IEFormGetCollection to get form content which was generated by javascript
      Local $oIE = _IECreate("https://www.example.com/login.html") ;Open the login page Local $oSpans = _IETagNameGetCollection($oIE, "span") For $oSpan In $oSpans if $oSpan.innertext == "Login" Then _IEAction($oSpan, "click") EndIf Next ;click span which ganerate by javascript login form Local $oForm = _IEFormGetCollection($oIE, 0) ;get my form, but that was not on website after loading, appears after click button and this function cant see it Local $oEmail = _IEFormElementGetObjByName($oForm, "email") ; trying to parse form but cant _IEFormElementSetValue($oEmail, "example@gmail.com") ; _IEFormGetCollection dont see generated dynamically elements Is here any way to _IETagNameGetCollection read website content again after i inititate a javascript which generate additional content?
    • dumbledown
      By dumbledown
      Hi,
      I'm new to AutoIt but it looks great.
      I want to get the text from Internet Explorer when hovering the mouse over an image, the statusbargettext function appears to be the way to go.
      When running via a hotkey I return a blank, but the msgbox works. Do you know what I'm doing wrong?
      Thanks
      HotKeySet("!x", "RecordURL") ;wait for ALT-a keystroke While 1 ;loop forever to wait for the keypress Sleep(100) ;no need to kill the CPU WEnd Func RecordURL() #include <MsgBoxConstants.au3> AutoItSetOption("WinTitleMatchMode", 2) Local $sText = StatusbarGetText("Internet Explorer") MsgBox($MB_SYSTEMMODAL, "", "Internet Explorer's status bar says: " & $sText) EndFunc  
       
    • 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?