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.

 


Wondering who uses AutoIT and what it can be used for ?


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-05-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.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 * GitHub API UDF - modest begining *

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 * _IEquerySelectorAll() (by uncommon) * 

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.

 

 


Wondering who uses AutoIT and what it can be used for ?


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-05-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.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 * GitHub API UDF - modest begining *

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 * _IEquerySelectorAll() (by uncommon) * 

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

    • 5ervant
      By 5ervant
      Go create a quick account in Zapier and go to https://zapier.com/app/dashboard and make some Zaps!
      Just need to click the specific instance of an .open-menu button and then click its a.run (anchor) element.
      Doing this IE.au3 script just causing to click its container element:
      $target = 1; Target the first instance #include <IE.au3> $oIE = _IEAttach("Dashboard - Zapier") $count = 0; $tags = _IETagNameGetCollection($oIE, "div") For $tag in $tags $class_value = $tag.GetAttribute("class") If $class_value = "open-menu" Then $count += 1 if $count = $target Then MsgBox(0, "Instance: ", $count) ; $tag.fireEvent("onmousedown") ; _IEAction($tag, "click") ; $tag.fireEvent("onmouseup") ; Or this but not working ; $tag.Click EndIf EndIf Next I also tried to do it using FF.au3
      $target = 1; Target the first instance #Include <Array.au3> #Include <FF.au3> $count = 0; If _FFConnect(Default, Default, 3000) Then $aArray = _FFXPath( "//div[@class='open-menu']", "", 7 ) ; _ArrayDisplay($aArray) For $tag in $aArray $count += 1 if $count = $target Then MsgBox(0, "Instance: ", $count) _FFClick($tag) EndIf Next EndIf Error: _FFClick ==> No match: $sElement: [number]
      Could some help me how to click such buttons on such kind of a dynamic page?
    • Gowrisankar
      By Gowrisankar
      Hello everyone,
      When I launch a URL and the webpage takes more time to load (say more than 1 minute), I want the URL to be relaunched.
      I used _IELoadWait(). But the control doesn't get pass through the _IELoadWait() command, since the webpage takes more time to load.
      I searched some of the older posts related to this topic. But I couldn't work them out.
      Please guide me.
    • elbhiri
      By elbhiri
      i have two files a.au3 and b.au3 the both contains the same code which is :
      #include <IE.au3> #include <MsgBoxConstants.au3> Global $myUrl = "https://www.autoitscript.com" RegWrite('HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main','SessionMerging','REG_DWORD','00000000') ShellExecute ("iexplore.exe", " -nosessionmerging about:blank") WinWait ("Blank Page") Global $oIE = _IEAttach ("about:blank", "url") _IELoadWait ($oIE) _IENavigate ($oIE, $myUrl) when i launch the both files in the same time two blank windows are opens.
      what im waiting for is that every window navigate to the link but what happen is the first and the second file navigate the url to the same window and the seconde window stay about:blank
      i think the problem happen because i try to open the same url in both windows
      so i need i way to navigate to the same url from two different windows
      Thanks in advance
    • HudsonKane
      By HudsonKane
      I have a page with several hundred <div>s, and each <div> has several hundred child <div>s, each with their own children
      when I use _IETagNameGetCollection($ie, "div", 0) I get them all, but I need to find a way to get say the 3rd child of the 5th child of the second top level <div>
      I have not yet been able to find anything along this line
      Is there any way to determine if an element is a child, parent, sibling?
      Thank you
    • 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.