Jump to content

IE.au3 Click button in specifc table.


Recommended Posts

The ID didn't change while I was trying. And there are three refresh buttons in your page. Third refresh button is the one in the Zlecnia (don't know what it means). 

#include <IE.au3>
#include <Array.au3>

Local $aRefreshButtons[0] ;there are three refresh buttons in your page
$oIE = _IECreate("https://www.supermakler.pkobp.pl/plus/demo/")
_IELoadWait($oIE)

$oDivs = _IETagNameGetCollection($oIE, "div")
For $oDiv In $oDivs
    If $oDiv.id <> "" And $oDiv.classname = " x-nodrag x-tool-refresh x-tool epm-toolButton x-component " Then
        ConsoleWrite($oDiv.id & " - " & $oDiv.className & @CRLF)
        _ArrayAdd($aRefreshButtons, $oDiv.id)
    EndIf
Next
_ArrayDisplay($aRefreshButtons)

$oRefreshButton = _IEGetObjById($oIE, $aRefreshButtons[2]) ;your refresh button is always the third
_IEAction($oRefreshButton, "focus")
If _IEAction($oRefreshButton, "click") Then
    ConsoleWrite("OK" & @CRLF)
    _IELoadWait($oIE)
Else
    ConsoleWrite("NOK" & @CRLF)
EndIf

;_IEQuit($oIE)

I'm sure there is a better way to solve this and I would learn the easier way too. 

TY.

Link to comment
Share on other sites

Another method:

#include <IE.au3>
$oIE = _IECreate("https://www.supermakler.pkobp.pl/plus/demo/", 1)
$oDivs1 = _IETagNameGetCollection($oIE, "Div")
For $oDiv1 In $oDivs1
    If StringInStr($oDiv1.id, "x-auto-") Then
        If StringStripWS($oDiv1.innertext, 8) = "Zlecenia" Then
            $oDivs2 = _IETagNameGetCollection($oDiv1, "Div")
            For $oDiv2 In $oDivs2
                If StringStripWS($oDiv2.ClassName, 7) = "x-nodrag x-tool-refresh x-tool epm-toolButton x-component" Then
                    _IEAction($oDiv2, "Click")
                EndIf
            Next
        EndIf
    EndIf
Next

 

Link to comment
Share on other sites

$nextstep = False
$oDivs1 = _IETagNameGetCollection($oIE, "Div")
For $oDiv1 In $oDivs1
    If StringInStr($oDiv1.classname, "epm-gadget-panel-edge-center") And StringStripWS($oDiv1.innertext, 8) == "Zlecenia" Then
        $nextstep = True
    EndIf

    If $nextstep == True And StringInStr($oDiv1.classname, "x-tool-refresh") Then
        _IEAction($oDiv1, "Click")
        $nextstep = False ;There are two "Zlecenia"
    EndIf
Next

There are two panes "Zlecenia" in tabs "Stan rachunku" and "Zlecenia", and I didn't use breakloop after first Click.

 

Edited by duzers
Link to comment
Share on other sites

Isn't the other named "Zlecenia Online"?  If you wanted to target this you would need to use:
Note, flag 7 removes beginning and end spaces + double spaces.  flag 8 removes all white space.  Also you can use single = if you aren't worried about string case, otherwise == to match the string exactly.

StringStripWS($oDiv1.innertext, 7) = "Zlecenia Online"

 

Link to comment
Share on other sites

Yes, there is "Zlecenia Online" but in the same tab. I used exactly comparison and it skipped "Zlecenia Online". Another "Zlecenia" is in tab "Stan rachunku" (look at the top of site). My code refresh all panes named "Zlecenia" but offcourse I can first check if it is in specific Tab.

Edited by duzers
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...