Jump to content
FrancescoDiMuro

Automating some tasks on HTML page...

Recommended Posts

FrancescoDiMuro

Good evening everyone :)

Before all, I want to say that I'm doing this script to see how _IE* functions work, and see if my studs can hack a quiz I'm working on.

I want to clarify that I'm not automating any game, bypassing any CAPTCHAs, or anything that could damage anyone.

I was trying to autofill a form, based on which question is displayed.

The question is always stored in here:

<header>
    <h1><span class="questionid">1. </span>Here goes the question</h1>
</header>

And answers are stored in here:

<ul class="answers">
    <li><label><span><input id="answer_0" name="answer[]" type="radio" value="0">Answer 1</span></label></li>
    <li><label><span><input id="answer_1" name="answer[]" type="radio" value="1">Answer 2</span></label></li>
    <li><label><span><input id="answer_2" name="answer[]" type="radio" value="2">Anwser 3</span></label></li>
    <li><label><span><input id="answer_3" name="answer[]" type="radio" value="3">Answer 4</span></label></li>
</ul></fieldset></form></div>

And, there are 15 questions like this.

How can automatically fill my form?

Thanks in advance :)

Francesco


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
junkew

try the examples of IE.UDF or search the forum.

If you do not take mitigations in your server part on speed of answers I am sure people can hack your frontend thru the browser (provide a list of questions/answers and fill the forms quickly is a piece of cake).

If you make your site internet reachable we can try on your site

Share this post


Link to post
Share on other sites
FrancescoDiMuro

Good morning @junkew:)

Thanks for your reply.

I was looking at _IE* functions, but, I was unable to access to h1 text.

I tried with this, but I didn't manage to access to the innertext of h1:

Local $objIE_h1 = _IETagNameGetCollection($objIE, "h1")
If @error Then
    ConsoleWrite("Errore durante la lettura degli h1 nella pagina. - Errore: " & @error & @CRLF)
Else
    Local $strInnerText = _IEPropertyGet($objIE_h1, "innertext") ; ===========> It returns error 4.
    If @error Then
        ConsoleWrite("Errore durante la lettura della proprietà di h1. - Errore: " & @error)
    Else
        MsgBox($MB_ICONINFORMATION, "", $strInnerText)
    EndIf
EndIf

What am I doing wrong? :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
junkew

You get a collection back get property will only work on 1 element at a time. so $objIE_h1[0] or $objIE_h1[1]

case sensitive maybe? innerText?

alternatives:       textContent or innerHTML

 

see this example 

https://www.autoitscript.com/autoit3/docs/libfunctions/_IETagNameAllGetCollection.htm

Edited by junkew

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@junkew

I tried with this code below, but errors occurs:

Local $objIE_h1 = _IETagNameGetCollection($objIE, "h1") ; => It should return just one h1, because in the page there is only one h1.
    If @error Then
        ConsoleWrite("Errore durante la lettura degli h1 nella pagina. - Errore: " & @error & @CRLF) ; => No errors here
    Else
;~      For $objElement In $objIE ; => This displays nothing
;~          ConsoleWrite($objElement.textContent & @CRLF)
;~      Next
        Local $strInnerText = _IEPropertyGet($objIE_h1[0], "innerText") ; If I try with array element, this is the error that it returns:
        ; Expected a variable in user function call.:
        ; Local $strInnerText = _IEPropertyGet($objIE_h1[0], "innerText") ; Tried with innertext, innerText and textContent, but it's the same...
        ; Local $strInnerText = _IEPropertyGet(^ ERROR
        
        If @error Then
            ConsoleWrite("Errore durante la lettura della proprietà di h1. - Errore: " & @error)
        Else
            MsgBox($MB_ICONINFORMATION, "", $strInnerText)
        EndIf
    EndIf

 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
junkew

try a loop around your example.

Check if you get 0,1 or n elements back

Local $oElements = _IETagNameAllGetCollection($objIE,"h1")
For $oElement In $oElements
    MsgBox($MB_SYSTEMMODAL, "Element Info", "Tagname: " & $oElement.tagname & @CRLF & "id: " & $oElement.id & @CRLF & "innerText: " & $oElement.innerText)
Next

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

I tried with this code right here, and nothing happened:

Local $objIE_h1 = _IETagNameGetCollection($objIE, "h1") ; => It's _IETagNameGetCollection(), and not _IETagNameAllGetCollection() as you prompted in the previous post!
    If @error Then
        ConsoleWrite("Errore durante la lettura degli h1 nella pagina. - Errore: " & @error & @CRLF)
    Else
        MsgBox($MB_ICONINFORMATION, "", @extended) ; => This MsgBox is to see how many h1 have been found ( It displays 1, as it is ).
        For $objElement In $objIE
            ConsoleWrite("Tagname: " & $objElement.tagname & @CRLF & "Id:" & $objElement.id & "Inner text:" & $objElement.innerText & @CRLF)
        Next

:)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
junkew

try the examples first to rule out nothing is wrong with your installation

Most likely there is no h1 (or maybe its case sensitive to be H1)

Whats your definition of "nothing happened" you either had output on console or a msgbox. If not the AutoIt broke on your first line of coding. 

I make the assumption you have the #include <IE.AU3> at top of your script.

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro
5 minutes ago, junkew said:

try the examples first to rule out nothing is wrong with your installation

The example gave me the expected result, so, I think we can exclude that there's nothing wrong with the installation of AutoIt;

5 minutes ago, junkew said:

Most likely there is no h1 (or maybe its case sensitive to be H1)

There is only one h1 in the HTML, and it's not H1. By the way, the @extended after the _IETagNameCollection() confirms what I'm saying.

5 minutes ago, junkew said:

Whats your definition of "nothing happened" you either had output on console or a msgbox. If not the AutoIt broke on your first line of coding. 

I tried with both ConsoleWrite() and MsgBox(), and in both cases I have had no output.

5 minutes ago, junkew said:

I make the assumption you have the #include <IE.AU3> at top of your script.

Absolutely yeah, or I should have had a bunch of errors in the script :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@junkew

Distraction errors have been always my Achille's heel!

Thank you so much! :)

Now I'll process this innerText with a Select...Case...EndSelect, and click on the correct answer...

Let's see :)

By the way, I'll post here if I'll need any information about _IE* functions :)

Thanks again for your support!

Have a wonderful day :)

Francesco


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

Good morning everyone :)

@junkew

I managed to have textes of questions, but now, I have to click on the correct answer in order to continue with the quiz form.

This is what I tried:

For $i = 0 To 3 ; There are 3 answers, so I scan them in this For...Next loop
    $objAnswer = _IEGetObjById($objIE, "answer_" & $i) ; According to the id of the form, I get the object
    If @error Then
        ConsoleWrite("Errore durante la lettura della risposta #" & $i & " - Errore: " & @error & @CRLF)
    Else
        $strAnswer = $objAnswer.value ; =================> Here, I tried with innerText, textContent, innerHTML, but I always have a blank string
                                      ;                    It seems to be good with textContent, because the script was doing the clicks, but now
                                      ;                    seems broken...
        ConsoleWrite("Risposta: " & $strAnswer & @CRLF)
        If StringInStr($strAnswer, "ANSWER") Then ; Here it is the answer
            _IEAction($objAnswer, "focus")
            If @error Then
                ConsoleWrite("Errore durante il click sull'elemento. - Errore: " & @error)
                $blnGo = False ; I use this in a nested While, in order to have a flag which let continue ( if True ) the loop...
            Else
                Send("{ENTER}", $SEND_DEFAULT)
                $blnGo = True
                ExitLoop
            EndIf
        EndIf
    EndIf
Next

EDIT:

This is the HTML code, and I have to extract the text "ANSWER":

<li><label><span><input id="answer_0" name="answer[]" type="radio" value="0">ANSWER</span></label></li>

What can I do? :)

Thanks :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@junkew

No text is retrieved between <input> TEXT </input>...

Maybe I should look for the <span> instead of <input> ?

I really don't know! :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
junkew

My advice is to make it first in Excel with VBA

1. new module

2. add thru menu tools, references to

a. Microsoft Internet Controls

b. Microsoft HTML controls

3. new subroutine like this

#If VBA7 Then
    Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
#Else
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If

Sub testie()
    Dim oIE As New InternetExplorer                'A new IE object
    Dim oDocument As HTMLDocument                  'The main document that is opened/navigated to
    Dim oElements As IHTMLElementCollection        'Collection of elements
    Dim oElement As IHTMLElement                   'A specific element that can be queried
    Dim iTry As Long
    
    oIE.Visible = True  'Make me visible
    
    oIE.Navigate2 "www.google.nl"   'Navigate to my website
    'Wait till page is loaded or 50 * 200 is 10 seconds max
    Do While (oIE.Busy Or oIE.readyState <> 4) And (iTry < 50)
        iTry = iTry + 1
        DoEvents
        Sleep 200
    Loop

    If (oIE.Busy Or oIE.readyState <> 4) Then
        MsgBox "something wrong with loading page"
    End If
    
    Set oDocument = oIE.document
    Set oElements = oDocument.getElementsByTagName("input")
    
    Debug.Print "Found elements length:" & oElements.Length
    For Each oElement In oElements
        Debug.Print oElement.Name & oElement.className & oElement.innerHTML & oElement.Type & oElement.Title & oElement.outerHTML
    Next
    
End Sub

4. press F5 run

5. And when you debug/breakpoint in the forloop you can reveal all properties in the locals\quickwatch window

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@junkew

I managed to do what I was trying to do with this:

$objSpans = _IETagNameGetCollection($objIE, "span")
                    For $objElement In $objSpans
                        If $i >= 4 Then
                            $strAnswer = $objElement.innerText ; Testo della risposta
                            If StringInStr($strAnswer, "ANSWER") Then
                                $j = $i - 4
                                ConsoleWrite($j & ") Risposta: " & $strAnswer & @CRLF)
                                $objInput = _IEGetObjById($objIE, "answer_" & $j)
                                If @error Then
                                    ConsoleWrite("Errore durante la lettura della risposta #" & $i & " - Errore: " & @error & @CRLF)
                                Else
                                    _IEAction($objInput, "click")
                                    If @error Then
                                        ConsoleWrite("Errore durante il click sull'elemento. - Errore: " & @error)
                                        $blnGo = False
                                    Else
                                        Send("{ENTER}", $SEND_DEFAULT)
                                        $blnGo = True
                                        ExitLoop
                                    EndIf
                                EndIf
                            EndIf
                            $i+=1
                        Else
                            $i+=1
                        EndIf
                    Next
                    $i = 0
                    $j = 0

but now, I have to timing the questions' scan ( because the scan is done as soon the answer is let, so... ).

How could I add a sort of "when the answer is let, then wait for a different question, and proceed with all the code".

Or something similiar... :)

Thanks in advance :)

Francesco

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@junkew

I managed with an infinite loop... 

A big thanks for all your help :)

Have a good day :)

Francesco


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

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

    • SkysLastChance
      By SkysLastChance
      So I have two things I am trying to click.
      Policy which works.
      $oInputs3 = _IETagNameGetCollection($oIE, "div") For $oInput3 in $oInputs3 If StringStripWS($oInput3.innertext,1) = "Policy" Then $target = $oInput3 _IELoadWait($target,"",70000) ExitLoop EndIf Next _IEAction($target, "click")  

      And Add Insurance which I havent been able to get to work. 
      $oInputs2 = _IETagNameGetCollection($oIE, "div") For $oInput2 in $oInputs2 If StringStripWS($oInput2.innertext,1) = "Add Insurance" Then $target = $oInput2 _IELoadWait($target,"",70000) ExitLoop EndIf Next _IEAction($target, "click")

      Any Ideas on what I am doing wrong?  I feel like it might be the spaces between >  Add Insurance  < but I am not sure. 
    • FMS
      By FMS
      Hello,
      I'm trying to read a div element and wait until it hits 100%.
      The structure is like :
      <div class="progress-bar" style="width: 48.0219%;  overflow: hidden; "></div>
      And want to wait until :
      <div class="progress-bar" style="width: 100%;  overflow: hidden; "></div>
      because afther this there will be an redirection whish i don't know the URL from and want to catsh this URL.
      And want to push a button on this redidertion page.

      Is there a best pratice way how to do this or is there a better way to wait for the redirection?
      Maybe wait until button exist or something?

      Does anybody could give me some tips about this challange?
       
      thnx in advanced.
       
      #include <IE.au3> Global $IE_flvto = _IECreate("https://www.website.com/",0,1,1,1) Global $oForm = _IEFormGetObjByName ($IE_flvto, "convertForm") Global $oText = _IEFormElementGetObjByName ($oForm, "convertUrl") _IEFormElementSetValue ($oText, "some text") _IEFormSubmit($oForm) ;wait for redirection ;if redirection loaded push button  
    • Juvigy
      By Juvigy
       Hi Guys,
      Could you please try out my script on win10 machine (simple site scrape)? One of my users complains it doesnt work on his win10, but it works fine on my win7. The error he gets is on the .FireEvent call. I think it is admin rights or IE / Edge issue, but don't have win10 to test it out.
      Thanks in advance.
       
      #include <IE.au3> #include <Array.au3> #include <Excel.au3> Global $oIE,$string Dim $destination[8] = ["Viña del Mar", "Rancagua", "Pucon", "Copiapo", "Temuco", "La serena", "Puerto Montt", "Valdivia"] Dim $FinalResult[1][3] $FinalResult[0][0] = "Destination" $FinalResult[0][1] = "Ida" $FinalResult[0][2] = "Vuelta" Attach("https://www.turbus.cl/") If IsObj($oIE) = 0 Then ConsoleWrite("IE error??"&@CRLF) $oIE = _IECreate() EndIf For $i=0 to UBound($destination)-1 Step 1 _IENavigate($oIE,"https://www.turbus.cl/") $site1 = _IEGetObjById($oIE,"j_id_id122:cmbCiudadOrigenV2") While @error Sleep(1000) $site1 = _IEGetObjById($oIE,"j_id_id122:cmbCiudadOrigenV2") WEnd $site2 = _IEGetObjById($oIE,"j_id_id122:cmbCiudadDestinoV2") $date1 = _IEGetObjById($oIE,"j_id_id122:calIdaV2InputDate") $date2 = _IEGetObjById($oIE,"j_id_id122:calVueltaV2InputDate") $buttun1 = _IEGetObjById($oIE,"j_id_id122:botonContinuarV2") $site1.Value = "Santiago" $site2.Value = $destination[$i] $date1.Value = @MDAY+1&"/"&@MON&"/"&@YEAR $date2.Value = @MDAY+4&"/"&@MON&"/"&@YEAR _IEAction($buttun1,"click") _IELoadWait($oIE) $array = GetResult(GetData()) If IsArray($array) = 0 OR UBound($array,1) < 1 Or UBound($array,2) < 2 Then MsgBox(0,UBound($array,1), UBound($array,2)) _ArrayDisplay($array,"$array") ContinueLoop EndIf _ArrayAdd($FinalResult,"Santiago-"&$destination[$i]&"|"&$array[0][0]&"|"&$array[0][1]) Next ;~ _ArrayDisplay($FinalResult) Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookNew($oExcel) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $FinalResult, "A1") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Func GetData() Local $string1,$string2 $ida = _IEGetObjById($oIE,"tbIda_lbl") While @error Sleep(1000) $ida = _IEGetObjById($oIE,"tbIda_lbl") WEnd _IEAction($ida,"click") Sleep(2000) $result1 = _IEGetObjById($oIE,"pnlReglaIda:idPersonalizaPasaje:tb") While @error $ida.FireEvent("onmouseover") Sleep(1000) $ida.FireEvent("onclick") Sleep(1000) $result1 = _IEGetObjById($oIE,"pnlReglaIda:idPersonalizaPasaje:tb") WEnd $string1 = $string1 & $result1.innertext&@CRLF $vuelta = _IEGetObjById($oIE,"tbVuelta_lbl") _IEAction($vuelta,"click") Sleep(2000) $result2 = _IEGetObjById($oIE,"pnlReglaVuelta:idPersonalizaPasajeRegreso:tb") While @error $vuelta.FireEvent("onmouseover") Sleep(1000) $vuelta.FireEvent("onclick") Sleep(1000) $result2 = _IEGetObjById($oIE,"pnlReglaVuelta:idPersonalizaPasajeRegreso:tb") WEnd $string2 = $string2 & $result2.innertext&@CRLF Return $string1&"|"&$string2 EndFunc Func Attach($atachadres) Local $i = 1 While 1 $oIE = _IEAttach("", "instance", $i) If @error = $_IEStatus_NoMatch Then $oIE = 0 ExitLoop EndIf If StringLeft(_IEPropertyGet($oIE, "locationurl"),StringLen($atachadres)) = $atachadres Then ExitLoop $i += 1 WEnd EndFunc Func GetResult($String) Dim $Master[0][2] ,$Master2[1][2] $2strings = StringSplit($String,"|",2) $Strings = StringSplit($2strings[0],@CRLF,2) $Strings = _ArrayUnique($Strings) For $i=0 to UBound($Strings)-1 Step 1 $Data = StringSplit($Strings[$i],"$",2) $add = _ArrayToString($Data) _ArrayAdd($Master,$add) Next For $i=UBound($Master,1)-1 to 0 Step -1 If $Master[$i][1] = "" Then _ArrayDelete($Master,$i) Next _ArraySort($Master,0, 0, 0,1) $Master2[0][0] = $Master[0][0]&$Master[0][1] Dim $Master[0][2] $Strings = StringSplit($2strings[1],@CRLF,2) $Strings = _ArrayUnique($Strings) For $i=0 to UBound($Strings)-1 Step 1 $Data = StringSplit($Strings[$i],"$",2) $add = _ArrayToString($Data) _ArrayAdd($Master,$add) Next For $i=UBound($Master,1)-1 to 0 Step -1 If $Master[$i][1] = "" Then _ArrayDelete($Master,$i) Next _ArraySort($Master,0, 0, 0,1) $Master2[0][1] = $Master[0][0]&$Master[0][1] Return $Master2 EndFunc  
    • SkysLastChance
      By SkysLastChance
      I have a goofy problem. I am hoping someone could shed some light. The example is not going around the text box. It is way off. 
      I have seen some post blaming IE 11, however I have IE11 on my desktop and it works fine.
      Is there anything I can do that might fix this? 
       
      ; Open a browser with the form example and get a reference to the form ; textarea element. Get the coordinates and dimensions of the text area, ; outline its shape with the mouse and come to rest in the center #include <IE.au3> Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm") Local $oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample") ; Get coordinates and dimensions of the textarea Local $iScreenX = _IEPropertyGet($oTextArea, "screenx") Local $iScreenY = _IEPropertyGet($oTextArea, "screeny") Local $iWidth = _IEPropertyGet($oTextArea, "width") Local $iHeight = _IEPropertyGet($oTextArea, "height") ; Outline the textarea with the mouse, come to rest in the center Local $iMousespeed = 50 MouseMove($iScreenX, $iScreenY, $iMousespeed) MouseMove($iScreenX + $iWidth, $iScreenY, $iMousespeed) MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight, $iMousespeed) MouseMove($iScreenX, $iScreenY + $iHeight, $iMousespeed) MouseMove($iScreenX, $iScreenY, $iMousespeed) MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed)  
       
    • FMS
      By FMS
      Hello,
      I try to get all the text from a news site around a subject.
      The first run I get all the text inside a attribute in an array.
      When i try to go back and reload another page it chrashes and think it because "$oIE.GoBack"
      I couldn't find anything in the help/forum around this subject.
      Do I need to reload the $oIE or something afther an X.GoBack?
      The error i got is :
      if $oTag2.GetAttribute("class") == "NewsDetail" Then if $oTag2^ ERROR I'm not shure why I got this error, maybe someone could explain?
      Also I'm open for some pointers in this test script because I'm pretty new in working whit the IE.UDF
      Maybe there is an simpler way to get the same results?

      test script:
      #include <IE.au3> #include <MsgBoxConstants.au3> #include <Array.au3> HotKeySet("{ESC}", "Terminate") Global $oIE = _IECreate("https://www.iex.nl/Zoeken/Nieuws.aspx?q=air%20france") ;get first subject Global $oLink1 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl00_linkNews") Sleep(500) _IEAction($oLink1, "click") Sleep(500) Global $oTags = _IETagNameGetCollection($oIE, "div") Global $aResults[1] For $oTag In $oTags if $oTag.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults, $oTag.innerTEXT) EndIf Next $aResults[0] = UBound($aResults) - 1 _ArrayDisplay($aResults, "Episodelist") ConsoleWrite($aResults[1] & @CRLF) $oIE.GoBack ;get second subject Global $oLink2 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl01_linkNews") Sleep(500) _IEAction($oLink2, "click") Sleep(500) Local $oTags2 = _IETagNameGetCollection($oIE, "div") Local $aResults2[1] For $oTag2 In $oTags2 if $oTag2.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults2, $oTag2.innerTEXT) EndIf Next $aResults2[0] = UBound($aResults2) - 1 ConsoleWrite($aResults2[1] & @CRLF) Func Terminate() _IEQuit($oIE) Exit EndFunc ;==>Terminate  
×