Seminko

Getting values from a second page of a table that is linked to by javascript

28 posts in this topic

Hey fellas,

so here's what's going on. I'm working on an Overtime calculator for my company's attendance system.

When you calculate all the values, you have to add overtime values from the month before which are stored in the following table:

prvnistranka_copy.thumb.jpg.e8b54bc6e0c0

I am able to access this data and grab what's necessary from both of the tabs in the table.

However

The brilliant coders thought it would be a good idea to only display 12 rows of values and put the rest to another page (as you can see at the bottom there is [1] and [2]. I can get the data from the second page of the table but only if I manually click it. Which, as you can imagine, would ruin the whole point of this tool.

Is there a way to somehow get the data from the second page of the table without manually clicking on it? Unfortunately, the link is the same link as the page itself so there is some javascript happening when clicked.

Thanks

Seminko

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You should look here:

[edit]I think this help you to click on "Next Page" button[/edit]

 

btw.

I am able to access this data and grab what's necessary from both of the tabs in the table.

Question: How you do this ?

 

mLipok

 

 

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

You should look here:

[edit]I think this help you to click on "Next Page" button[/edit]

 

btw.

Question: How you do this ?

 

mLipok 

Thanks, I will look into that.

 

Basically I do:

$oIE  = _IEAttach("xyz", "URL")
$oTable = _IETableGetCollection ($oIE) ; Gets the tables
$iNumTables = @extended ; Gets the table IDs

; and then itterate through all of them to find the ones I need

#cs
*************** THIS IS TO CHECK FOR THE TABLE NUMBER *********************
MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page")
For $i = 1 To $iNumTables+1
    $oTable = _IETableGetCollection ($oIE, $i)
    $aTableData = _IETableWriteToArray ($oTable)
    _ArrayDisplay($aTableData)
Next
*************** THIS IS TO CHECK FOR THE TABLE NUMBER *********************
#ce

; Once I have the correct table IDs I do:

$oTable = _IETableGetCollection ($oIE, 26)

; and then create an array from them:

$aTableData = _IETableWriteToArray ($oTable)

 

Share this post


Link to post
Share on other sites

 

Basically I do:

$oIE  = _IEAttach("xyz", "URL")
.....

So this is normal Web Page

You should be able to click on ">" next page button with _IE.. functions

Inspect this item and show HTML code related to this button.


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

So this is normal Web Page

You should be able to click on ">" next page button with _IE.. functions

Inspect this item and show HTML code related to this button.

I tried F12 and a DOM model explorer showed up. I chose "Select Element" and clicked on the [2] link, this showed up:

<td class="dxpPageNumber_Glass" style="cursor: pointer;" onclick="aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');">2</td>

How do I get the element name or ID? _IEAction uses _IEGetObjByName($oIE, "ExampleForm") but I don't know what the name of that object is.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Not always ID is the only way to find a way to click :

#include <StringConstants.au3>
#include <ie.au3>

_Example()
Func _Example()

    .........
    Local $oMyTable = .....
    .......

    Local $sMyOnClickString = "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');"
    Local $oTD = _IE_Table_GetTD($oMyTable, $sMyOnClickString)
    If @error Then Return SetError(@error, @extended, 0)
    $oTD.Click()
EndFunc   ;==>_Example


Func _IE_Table_GetTD(ByRef $oTable, $sOnClickString, $bRegExp = False)
    Local $oTRs_coll = $oTable.rows
    For $oTR_enum In $oTRs_coll
        For $oTD_enum In $oTR_enum.cells
            If $bRegExp Then
                If StringRegExp($oTD_enum.onclick, $sOnClickString, $STR_REGEXPMATCH) Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            Else
                If $oTD_enum.onclick = $sOnClickString Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            EndIf
        Next
    Next

    SetError($_IESTATUS_NoMatch, 0, Null)
EndFunc   ;==>_IE_Table_GetTD

 

REMARK: Not tested.

 

Edited by mLipok
$oObject >> $oTable

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

So what I need is to specify the table?

Like:

$oMyTable = _IETableGetCollection ($oIE, 26)

EDIT:

"xyz.au3"(18,37) : warning: $oObject: possibly used before declaration.
    Local $oTRs_coll = $oObject.rows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Edited by Seminko

Share this post


Link to post
Share on other sites

"xyz.au3"(18,37) : warning: $oObject: possibly used before declaration.
    Local $oTRs_coll = $oObject.rows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Now is tested ;)

Try again (script fixed)


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Please try also this:
 

Func _IE_MODI2(ByRef $oIE)
    _IENavigate($oIE, "javascript:prefFile='';void(z=document.body.appendChild(document.createElement('script')));void(z.language='javascript');void(z.type='text/javascript');void(z.src='http://slayeroffice.com/tools/modi/v2.0/modi_v2.0.js');void(z.id='modi');")
    If @error then Return SetError(@error, @extended, '')
EndFunc

 

 

Example:

#include <ie.au3>

_Example()

Func _Example()
    Local $oIE = _IECreate('http://stackoverflow.com/')
    _IE_MODI2($oIE)
    If @error Then MsgBox(0, '', _
    '@error = ' & @error & @CRLF & '@extended = ' & @extended)
EndFunc


Func _IE_MODI2(ByRef $oIE)
    _IENavigate($oIE, "javascript:prefFile='';void(z=document.body.appendChild(document.createElement('script')));void(z.language='javascript');void(z.type='text/javascript');void(z.src='http://slayeroffice.com/tools/modi/v2.0/modi_v2.0.js');void(z.id='modi');",0)
    If @error then Return SetError(@error, @extended, '')
EndFunc

You can copy to clipboard:

a [paused]

attributes

dimensions

  • Width : 45px
  • Height : 34px
  • Top : 0px
  • Left : 646px

parent structure

  • html
  • body class="home-page new-topbar"
  • div class="topbar"
  • div class="topbar-wrapper"
  • div class="topbar-links"
  • div class="links-container"
  • span class="topbar-menu-links"

children

  • #text

This should help in analysis.

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

EDIT, so I tried:

#include <ie.au3>

_Example()

Func _Example()
    Local $oIE = _IEAttach("bpowebtarget", "URL")
    _IE_MODI2($oIE)
    If @error Then MsgBox(0, '', _
    '@error = ' & @error & @CRLF & '@extended = ' & @extended)
EndFunc


Func _IE_MODI2(ByRef $oIE)
    _IENavigate($oIE, "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');")
    If @error then Return SetError(@error, @extended, '')
EndFunc

Which basically just tried to open a new tab with "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');" as the address.

 

EDIT2: Just tried looking at the arrow and it says:

<img class="dxWeb_pNext_Glass" style="border-width: 0px;" alt="Next" src="/DXR.axd?r=1_3-wJEc3">

Does that help us?

Edited by Seminko

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

so here is some testing:

Func _IE_Table_GetTD(ByRef $oTable, $sOnClickString, $bRegExp = False)
    Local $oTRs_coll = $oTable.rows
    ConsoleWrite('TD Contents Start:' & @CRLF)
    For $oTR_enum In $oTRs_coll
        For $oTD_enum In $oTR_enum.cells
            ConsoleWrite($oTD_enum.onclick & @CRLF)
            If $bRegExp Then
                If StringRegExp($oTD_enum.onclick, $sOnClickString, $STR_REGEXPMATCH) Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            Else
                If $oTD_enum.onclick = $sOnClickString Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            EndIf
        Next
    Next
    ConsoleWrite('TD Contents END' & @CRLF)

    SetError($_IESTATUS_NoMatch, 0, $oTD_enum)
EndFunc   ;==>_IE_Table_GetTD

What you see in console when you use it ?

EDIT: Of course strip your secret data ;)

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

TD Contents Start:

TD Contents END
+>22:24:09 AutoIt3.exe ended.rc:0
+>22:24:09 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 3.079

 

Here's what I got:

#include <StringConstants.au3>
#include <ie.au3>

Sleep(2500)
_Example()

Func _Example()
    $oIE  = _IEAttach("xyz", "URL")
    $oTable = _IETableGetCollection ($oIE)
    Local $oMyTable = _IETableGetCollection ($oIE, 78)
    Local $sMyOnClickString = "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');"
    Local $oTD = _IE_Table_GetTD($oMyTable, $sMyOnClickString)
    If @error Then Return SetError(@error, @extended, 0)
    $oTD.Click()
EndFunc   ;==>_Example


Func _IE_Table_GetTD(ByRef $oTable, $sOnClickString, $bRegExp = False)
    Local $oTRs_coll = $oTable.rows
    ConsoleWrite('TD Contents Start:' & @CRLF)
    For $oTR_enum In $oTRs_coll
        For $oTD_enum In $oTR_enum.cells
            ConsoleWrite($oTD_enum.onclick & @CRLF)
            If $bRegExp Then
                If StringRegExp($oTD_enum.onclick, $sOnClickString, $STR_REGEXPMATCH) Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            Else
                If $oTD_enum.onclick = $sOnClickString Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            EndIf
        Next
    Next
    ConsoleWrite('TD Contents END' & @CRLF)

    SetError($_IESTATUS_NoMatch, 0, $oTD_enum)
EndFunc   ;==>_IE_Table_GetTD

 

Edited by Seminko

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

and try this:

#include <StringConstants.au3>
#include <ie.au3>

Sleep(2500)
_Example()

Func _Example()
    $oIE  = _IEAttach("xyz", "URL")
    $oTable = _IETableGetCollection ($oIE)
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    Local $oMyTable = _IETableGetCollection ($oIE, 78)
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    Local $sMyOnClickString = "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');"
    Local $oTD = _IE_Table_GetTD($oMyTable, $sMyOnClickString)
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    $oTD.Click()
EndFunc   ;==>_Example


Func _IE_Table_GetTD(ByRef $oTable, $sOnClickString, $bRegExp = False)
    Local $oTRs_coll = $oTable.rows
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    ConsoleWrite('TD Contents Start:' & @CRLF)
    For $oTR_enum In $oTRs_coll
        For $oTD_enum In $oTR_enum.cells
            ConsoleWrite($oTD_enum.onclick & @CRLF)
            If $bRegExp Then
                If StringRegExp($oTD_enum.onclick, $sOnClickString, $STR_REGEXPMATCH) Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            Else
                If $oTD_enum.onclick = $sOnClickString Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            EndIf
        Next
    Next
    ConsoleWrite('TD Contents END' & @CRLF)

    SetError($_IESTATUS_NoMatch, 0, $oTD_enum)
EndFunc   ;==>_IE_Table_GetTD

 

EDIT:

Other possible way to try is :

_IENavigate($oIE, "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');")

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

TD Contents Start:

TD Contents END
! #17 @error=7 @extended=0
+>22:35:57 AutoIt3.exe ended.rc:0
+>22:35:57 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 3.14

 

IENavigate doesn't work either, as I mentioned above. It just tries to load "http://aspxgvpageronclick('ctl00_contentplaceholder1_aspxroundpanel1_pcprehled_aspxcpprescasy_aspxcpprescasygrid_gv1','pn1');/"

Edited by Seminko

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I miss your last post. Sorry.

Try this:

#include <StringConstants.au3>
#include <ie.au3>

Sleep(2500)
_Example()

Func _Example()
    $oIE  = _IEAttach("xyz", "URL")
    $oTable = _IETableGetCollection ($oIE)
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    Local $oMyTable = _IETableGetCollection ($oIE, 78)
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    Local $sMyOnClickString = "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');"
    Local $oTD = _IE_Table_GetTD($oMyTable, $sMyOnClickString)
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    $oTD.Click()
EndFunc   ;==>_Example


Func _IE_Table_GetTD(ByRef $oTable, $sOnClickString, $bRegExp = False)
    Local $oTRs_coll = $oTable.rows
    If @error then Return ConsoleWrite('! #' & @ScriptLineNumber & ' @error='& @error &' @extended=' & @extended & @CRLF)

    ConsoleWrite('TD Contents Start:' & @CRLF)
    For $oTR_enum In $oTRs_coll
        For $oTD_enum In $oTR_enum.cells
            ConsoleWrite($oTD_enum.onclick & @CRLF)
            If $bRegExp Then
                If StringRegExp($oTD_enum.outerhtml, $sOnClickString, $STR_REGEXPMATCH) Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            Else
                If StringInStr($oTD_enum.outerhtml, $sOnClickString) Then Return SetError($_IESTATUS_Success, 0, $oTD_enum)
            EndIf
        Next
    Next
    ConsoleWrite('TD Contents END' & @CRLF)

    SetError($_IESTATUS_NoMatch, 0, Null)
EndFunc   ;==>_IE_Table_GetTD

 

Edited by mLipok
1 person likes this

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Wow that works man! Good job.

Now, is there a way to make it faster?

I will also need to set up a check for whether there is actually the [2] button. It seems that for the [2] button there is " 'PN1' ". So if there was a [3] button we would look for " 'PN2' ".

I think I can create an array from the table that holds the page numbers and check for the highest number. If it is let's say 10, I can then do " 'PN9' ".

 

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Is it always last Row in the table ?
How many rows is in this table ?

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Ok, I did this:

$oTablePagesSaldo = _IETableGetCollection ($oIE, $TableForDruhaStrankaSaldaID) ; $TableForDruhaStrankaSaldaID is the table which shows the number of pages
$oTableDataPagesSaldo = _IETableWriteToArray ($oTablePagesSaldo)
If StringInStr($oTableDataPagesSaldo[0][0], "Page") > 0 Then ; Checks if the first part of the array says "Page", if it doesn't there is only one page and we do not need to click anything.
    $oTableDataPagesSaldoPosledniStrankaHledejOF = StringInStr($oTableDataPagesSaldo[0][0], "of") ; Page 1 of 2 (14 items) / Looks for the position of "of"
    $oTableDataPagesSaldoPosledniStrankaHledejZavorku = StringInStr($oTableDataPagesSaldo[0][0], " (") ; Looks for the position of "("
    $oTableDataPagesSaldoPosledniStrankaData = StringMid($oTableDataPagesSaldo[0][0], $oTableDataPagesSaldoPosledniStrankaHledejOF + 3, $oTableDataPagesSaldoPosledniStrankaHledejZavorku - $oTableDataPagesSaldoPosledniStrankaHledejOF - 3) ; returns the number of highest number of the pages
    ;MsgBox(1, "", $oTableDataPagesSaldoPosledniStrankaData)
    ;_ArrayDisplay($oTableDataPagesSaldo)

    Local $sMyOnClickString = "aspxGVPagerOnClick('ctl00_ContentPlaceHolder1_ASPxRoundPanel1_PCPrehled_ASPxCPPrescasy_ASPxCPPrescasyGrid_GV1','PN1');" ; here I will replace the 'PN1' with sth like 'PN' & $oTableDataPagesSaldoPosledniStrankaData - 1
    Local $oTD = _IE_Table_GetTD($oTablePagesSaldo, $sMyOnClickString)
    $oTD.Click()
EndIf

EDIT: however, is there a way for the script to wait until the page is fully loaded after " $oTD.Click() " ?

Edited by Seminko

Share this post


Link to post
Share on other sites

EDIT: however, is there a way for the script to wait until the page is fully loaded after " $oTD.Click() " ?

_IELoadWait($oIE)

btw.

You can change this:

$oTD.Click()

to this:

_IEAction($oTD,'click')

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
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

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 SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer 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."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Is there a way to check if a tickbox is ticked or not?

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