Jump to content

IE Click on text (ajax) (solved)


Recommended Posts

Hi All :)

I have read many posts, I have made many attempts but I could not click on the text :(

The text I am trying to click on the page is "Reinstalacja komputera".
Can anyone help me please?

I've attached a screenshot of the FireFox debugger

Thank you

screen.jpg

Link to comment
Share on other sites

Hi Francesco.

$sMName = "Reinstalacja Komputera"
            $oTable = _IETableGetCollection($oIE, 1)
            $oTds = _IETagNameGetCollection($oTable, "td")
            For $oTD In $oTds
                If String($oTD.innertext) = $sMName Then
                    MsgBox(0, "", $oTD.innertext)
                    _IEAction($oTD, "click")
                    ExitLoop
                EndIf
            Next

MsgBox shows "Reinstalacja komputera" but no click at all.

Unfortunately it does not work :(

Edited by Zmylna
Link to comment
Share on other sites

14 minutes ago, FrancescoDiMuro said:

@Zmylna
First, try to see if some function returns an error doing this:

_IEFunction()
If @error Then
    ConsoleWrite("An error occured with _IEFunction! ERR: " & @error & @CRLF)
    Exit
Else
    ; Keep with the script
EndIf

:)

Francesco, sorry for stupid question but where exactly paste this code ?

On the begining of the script ?

Edited by Zmylna
Link to comment
Share on other sites

$sMName = "Reinstalacja Komputera"
            $oTable = _IETableGetCollection($oIE, 1)

            ;###
            If @error Then
                ConsoleWrite("An error occured with _IEFunction! ERR: " & @error & @CRLF)
                Exit
            Else
                ; Keep with the script
            EndIf
            ;###

            $oTds = _IETagNameGetCollection($oTable, "td")
            ;###
            If @error Then
                ConsoleWrite("An error occured with _IEFunction! ERR: " & @error & @CRLF)
                Exit
            Else
                ; Keep with the script
            EndIf
            ;###

            For $oTD In $oTds
                If String($oTD.innertext) = $sMName Then
                    MsgBox(0, "", $oTD.innertext)
                    _IEAction($oTD, "click")
                    ;###
                    If @error Then
                        ConsoleWrite("An error occured with _IEFunction! ERR: " & @error & @CRLF)
                        Exit
                    Else
                        ; Keep with the script
                    EndIf
                    ;###
                    ExitLoop
                EndIf
            Next

No Errors in console.

Link to comment
Share on other sites

@Zmylna

So the code is processed correctly.

But it seems that you are looking in the wrong place (TD's instead of button_js's).

I am not very familiar with JS, but you should be able to get a collection of those and search for the innertext of the button instead of the td.

Give it a try :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

36 minutes ago, FrancescoDiMuro said:

@Zmylna

So the code is processed correctly.

But it seems that you are looking in the wrong place (TD's instead of button_js's).

I am not very familiar with JS, but you should be able to get a collection of those and search for the innertext of the button instead of the td.

Give it a try :)

Understand.

Can you tell me how to find "button_js" in this case ?

I try to replace "td" with "button_js" but still nothing.

Edited by Zmylna
Link to comment
Share on other sites

14 minutes ago, FrancescoDiMuro said:

You need to add another _IETagNameGetCollection() with button_js and not replace the td one, because the button_js is contained in a td element :)

hmm.

Something like this ?

$sMName = "problem z poczta"

            $oTds = _IETagNameGetCollection($oIE, "td")

            For $oTD In $oTds
                If String($oTD.innertext) = $sMName Then

                    ;=============================================
                    $a= _IETagNameGetCollection($oTD, "button_js")
                    for $n in $a
                        msgbox(0,"",String($n.innertext))
                    Next
                    ;=============================================
                    MsgBox(0, "", $oTD.innertext)
                    _IEAction($oTD, "click")

                    ExitLoop
                EndIf
            Next

 

Link to comment
Share on other sites

OK, i got it ! :)

This code works:

$sMName = "problem z poczta"

            $oTds = _IETagNameGetCollection($oIE, "td")

            For $oTD In $oTds
                If String($oTD.innertext) = $sMName Then

                    $a = _IETagNameGetCollection($oTD, "button_js")

                    For $n In $a
                        If String($n.innertext) = $sMName Then
                            _IEAction($n, "click")
                            ExitLoop
                        EndIf
                    Next

                    ExitLoop
                EndIf
            Next

Thank you Francesco :)

Link to comment
Share on other sites

  • Zmylna changed the title to IE Click on text (ajax) (solved)

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...